Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wordalert没有处理符号. #32

Open
chenjinyuan87 opened this issue Dec 22, 2017 · 6 comments
Open

wordalert没有处理符号. #32

chenjinyuan87 opened this issue Dec 22, 2017 · 6 comments

Comments

@chenjinyuan87
Copy link

att。
我也不知道这是个什么鬼,全角的.?
总之我这边直接改源码加上了~
在69之后加上这个:
CHARCOVER['.'] = '.';

@ansjsun
Copy link
Member

ansjsun commented Dec 22, 2017

这个是。。将句子标准化。

把所有的全角 数字。英文 ,大小写(不确定),改成半角。。小写

这个符号为啥子要处理呀?

@chenjinyuan87
Copy link
Author

嗯,因为我看到有文章写 5.5什么的。。。那个5也是个全角字符。
我觉得这算是全角数字中的.吧?。。。

@ansjsun
Copy link
Member

ansjsun commented Feb 14, 2018

要是加上估计问题挺多容我考虑再三

@ren545457803
Copy link

可以考虑再加一个功能:全角、半角转换

@ansjsun
Copy link
Member

ansjsun commented Feb 25, 2019 via email

@ren545457803
Copy link

WordAlert 有这个功能 在2019年02月25日 17:13,Yabin Ren 写道: 可以考虑再加一个功能:全角、半角转换 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

可以考虑用计算的方式把所有全半角转换。参考:https://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2

` public static final char HALF_WIDTH_SPACE = '\u0020';
public static final char FULL_WIDTH_SPACE = '\u3000';

public static final char HALF_WIDTH_START = '\u0021';
public static final char HALF_WIDTH_END = '\u007E';

public static final char FULL_WIDTH_START = '\uFF01';
public static final char FULL_WIDTH_END = '\uFF5E';

/**

  • 将全角转换为半角
  • @param full 全角字符
  • @return 半角字符
    */
    public static char toHalf(char full) {
    if (full == FULL_WIDTH_SPACE) {
    return HALF_WIDTH_SPACE;
    } else if (full >= FULL_WIDTH_START && full <= FULL_WIDTH_END) {
    return (char) (full - FULL_WIDTH_START + HALF_WIDTH_START);
    } else {
    return full;
    }
    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants