Giter Site home page Giter Site logo

mojimoji's People

Contributors

ikuyamada avatar odidev avatar ryanchentw avatar tamuhey avatar tomotaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mojimoji's Issues

ライセンスの表記

よく使わせてもらっています!ありがとうございます!
再利用のため、ライセンスを明示していただきたいです。

building on windows

It can be built on windows using VS if

cdef extern from "<tr1/unordered_map>" namespace "std::tr1":
is replaced by
cdef extern from "<unordered_map>" namespace "std":

also building is easier if

from Cython.Build import cythonize
ext_modules = cythonize('mojimoji.pyx')

is used.

Cannot install on Python 3.12

Cythonについてはあまり詳しくないのですが、Cythonのコードがc++に変換される際にPyUnicode_FromUnicodeを使用しているように見えます。
これは削除が予告されていた非推奨APIであり、予告通りに3.12.0にて削除されたためエラーが発生しています。


mojimoji.pyx is converted to C++ code using PyUnicode_FromUnicode.
However, PyUnicode_FromUnicode is a legacy interface and has been removed in Python 3.12.

https://docs.python.org/3.12/c-api/unicode.html
https://docs.python.org/3.11/c-api/unicode.html
https://peps.python.org/pep-0623/

Therefore, the following error occurs on Python 3.12.

[20:21:32] tpdn@GrandMacdoBookProXP /Users/tpdn/gitlab/tpdn/hoge [2] 
> pdm add mojimoji
Adding packages to default dependencies: mojimoji
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with resolved packages: 1 to add, 0 to update, 0 to remove

  ✖ Install mojimoji 0.0.12 failed
Retry failed jobs
  ✖ Install mojimoji 0.0.12 failed

ERRORS:
add mojimoji failed:
Traceback (most recent call last):
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/installers/synchronizers.py", line
283, in install_candidate
    self.manager.install(can)
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/installers/manager.py", line 33, 
in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
                  ^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/models/candidates.py", line 395, 
in build
    self.wheel = Path(builder.build(build_dir, metadata_directory=self._metadata_dir))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/wheel.py", line 28, in 
build
    filename = self._hook.build_wheel(out_dir, config_settings, metadata_directory)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pyproject_hooks/_impl.py", line 209, 
in build_wheel
    return self._call_hook('build_wheel', {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pyproject_hooks/_impl.py", line 311, 
in _call_hook
    self._subprocess_runner(
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/base.py", line 260, in 
subprocess_runner
    return log_subprocessor(cmd, cwd, extra_environ=env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/base.py", line 107, in 
log_subprocessor
    raise build_error(e) from None
pdm.exceptions.BuildError: Build backend raised error: Showing the last 10 lines of the build output:
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
                                             ^
mojimoji.cpp:5212:16: error: use of undeclared identifier 'PyUnicode_FromUnicode'
  __pyx_t_10 = __Pyx_PyUnicode_FromUnicode(__pyx_v_buf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 186, 
__pyx_L1_error)
               ^
mojimoji.cpp:1323:46: note: expanded from macro '__Pyx_PyUnicode_FromUnicode'
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
                                             ^
2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1

See /var/folders/1b/fvjyq4dn47d19yyhd39w4qs80000gn/T/pdm-install-n40llblw.log for detailed debug log.
[InstallationError]: Some package operations are not complete yet
Add '-v' to see the detailed traceback

バックスラッシュが変換されない

バックスラッシュ(\: U+005C, : U+FF3C)が変換されません。

>>> print(mojimoji.han_to_zen('\\'))
\
>>> print(mojimoji.zen_to_han('\'))
\

mojimoji.pyxASCII_ZENKAKU_CHARSASCII_HANKAKU_CHARSにバックスラッシュが設定されていないようです。
可能でしたら追加していただけると幸いです。

OS X Support?

Seems "<tr1/unorderd_map>" is not effective on OS X. Clang does not understand it and thus compile fails.

Simple solution for my Mac would be removing "tr1" happening in mojimoji.cpp, while it makes debian wheezy unhappy instead (as the os uses gcc 4.7 which requests "-std=c++11" option)

dmiyakawa@5d4299d

インストール時にエラーが・・・

Python Vason 3.5.2にてインストールにエラーが発生してしまうのですが解決方法はありますか?
↓コマンドログ
C:\WINDOWS\system32>pip install mojimoji
Collecting mojimoji
Using cached mojimoji-0.0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sutep\AppData\Local\Temp\pip-build-t1q268nc\mojimoji\setup.py", line 14, in
long_description=open('README.rst').read(),
UnicodeDecodeError: 'cp932' codec can't decode byte 0xef in position 563: illegal multibyte sequence

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\sutep\AppData\Local\Temp\pip-build-t1q268nc\mojimoji\

インストール時のエラー(Microsoft Visual C++ 14.0 is required.)

Windows 7、Python3.6.5からpipでインストールしようとしたところ、下記のエラーが発生しました。

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

記載のURLに遷移すると、期限切れらしくビルドツールのダウンロードはできませんでした。
どうすればよろしいでしょうか。

よろしくお願いいたします。

DLL load failed: 指定されたモジュールが見つかりません。

インストールはできましたが、
pip install mojimoji

Collecting mojimoji
Using cached mojimoji-0.0.11-cp36-cp36m-win_amd64.whl (35 kB)
Installing collected packages: mojimoji
Successfully installed mojimoji-0.0.11

import時にエラーが起きました。

Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import mojimoji
Traceback (most recent call last):
File "", line 1, in
ImportError: DLL load failed: 指定されたモジュールが見つかりません。

¥マークの扱いについて

いつも使用させていただいております。
さて、¥マークを変換しようとしたところ予想と違った挙動をしていました。

>>> unicodedata.east_asian_width('¥')
'Na'
>>> mojimoji.han_to_zen('¥')
'¥'
>>> mojimoji.han_to_zen('$')
'$'
>>> mojimoji.han_to_zen('#')
'#'
>>> mojimoji.han_to_zen('!')
'!'
>>> mojimoji.zen_to_han('¥')
'¥'
>>> mojimoji.zen_to_han('$')
'$'
>>> mojimoji.zen_to_han('#')
'#'
>>> mojimoji.zen_to_han('!')
'!'

これらをみると円マークは仲間はずれになっているのかなと思いました。(使用しているOSはMacです)
何か設計上の意図があれば教えていただけると助かります。

Add support to release aarch64 wheels

Problem

On aarch64, ‘pip install mojimoji’ builds the wheels from source code and then installs it. It requires the user to have a development environment installed on his system. Also, it takes some time to build the wheels than downloading and extracting the wheels from pypi.

Resolution

On aarch64, ‘pip install mojimoji’ should download the wheels from pypi

@ikuyamada Please let me know your interest in releasing aarch64 wheels. I can help in this.

Windowsでpip install 不可

現状、Windows環境でpip install mojimoji とすると0.0.8をインストールしようとしてunorderd_mapの問題にぶつかります。
最新版はpip install mojimoji=0.0.9 では見つからず、pip install mojimoji=0.0.9_2 でインストールできます。
PyPIへの登録の問題なのかもしれませんが、対処頂けると幸いです。

常用外のカナと濁点の組み合わせでのバグ(?)

意図していない挙動のように思われるので報告させていただきます。

概要

常用外のカナと濁点の組み合わせ("ア゙", "カ゚"など)にhan_to_zenすると、その組み合わせが出現した時点で中断された文字列がreturnされる。

>>> import mojimoji
>>> print mojimoji.han_to_zen(u'ガギグゲゴ')
ガギグゲゴ    # 常用の組み合わせ→OK
>>> print mojimoji.han_to_zen(u'アイウエオア゙イ゙ヴエ゙オ゙あいうえお')
アイウエオ    # 常用外の組み合わせ→NG

環境

mojimoji: 0.0.5
Windows7 / Python2.7.10

kana_ten_hz_tableなどのテーブルを参照しにいった際、該当するものがないと終端文字に置き換わってしまっているような挙動です。

めっちゃ環境依存なバグ

import mojimoji
​
def baguru(text):
    text = mojimoji.zen_to_han(text, kana=False)
    
    text = mojimoji.han_to_zen(text, digit=False, ascii=False)
    return text
​
def baguranai(text):
    text = mojimoji.zen_to_han(text, kana=False)
    a=0
    for i in range(10):
        a+=i
    text = mojimoji.han_to_zen(text, digit=False, ascii=False)
    return text
​
text ="゙ンライフレキ"
text = baguru(text)
#text = baguranai(text)
print(text)

この関数を実行したとき, baguru関数を実行すると double free or corruption (out) のバグが出ました。
baguru関数とbaguranai の違いは、間に別の処理が挟まってるかどうかだけです。
ちなみに文字列による差も激しく、 先頭が濁点の場合しかバグりませんでした。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.