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

added option feature for reverse_lookup_filter #590

Closed
wants to merge 2 commits into from

Conversation

shewer
Copy link
Contributor

@shewer shewer commented Nov 27, 2022

增加Signed-off-by: Shewer Lu shewer@gmail.com

Pull request

Feature

Describe feature of pull request
增加 reverse_lookup_filter 開關(option)機制

  1. enable_option 為此機制開關 ,OFF: TagsMatch(segment) ON: TegsMatch(segment) && get_option()
  2. option_name: 以 option_name 取得 Bool 狀態

Unit test

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

.schema.yaml

  1. <name_space>/enable_option: bool # default false
  2. <name_space>/option_name: string # enable : default name_space

Signed-off-by: Shewer Lu <shewer@gmail.com>
Signed-off-by: Shewer Lu <shewer@gmail.com>
@lotem
Copy link
Member

lotem commented Jan 16, 2023

enable_option 我覺得不美。

reverse_lookup_filter 不是要看tag嗎?用戶都輸入反查標記了,那還能關閉,這塊兒具體怎樣運用,不太理解。

@shewer
Copy link
Contributor Author

shewer commented Jan 16, 2023

enable_option 我覺得不美。

reverse_lookup_filter 不是要看tag嗎?用戶都輸入反查標記了,那還能關閉,這塊兒具體怎樣運用,不太理解。

在設定可以有多個方式的選擇
目前反查的教學,是用patterns 置換不同tag辦到不不同反查字典 ,且是針對主字典,也沒有錯,只是設定有點繞 ,如果要同時可以 反查主字典 副字典得在 extra_tags patterns 下調整

使用option 可以提供另一條路,以直觀的設定反查機制 ,在不設定tags條件下
以option 開關設定
shift_L set_option enable
shift_l release unset_option
反查pattern tag: reverse_lookup
reverse_lookup
extra_tag: [ r1, r2,r3]使用 option打開茆一個 ( 可用戶switches option[ r1 , r2, r3] 打開其中一個

@lotem
Copy link
Member

lotem commented Jan 25, 2023

可以只用 tag 控制要不要過濾,分別用 "過濾", "不過濾" 對應開關狀態。

@lotem lotem closed this Jan 25, 2023
@shewer
Copy link
Contributor Author

shewer commented Jan 25, 2023

可是 recognizer 與matcher 須配合 input 才能打 tag 來切換反查filter
recognizer 設置多反查tag pattern 複雜度高且因 recognizer 檢查pattern match 井非全部橙查
在N個translator + n個反查filter 情況下 要設定pattern 着實不昜
abc:
trana: A[a-z]*
tranb: B[a-z]*

reverse1:
reverse2:
在patterns 和 tag extra_tags 設定上不容易操控, 時不時 還得 加上 affix_segmentor 拿掉前後綴字元

使用 option開關, 配合 switches 中 options 可以 在 tag 'abc ' 全時打開反查 及 切換反查字典 類似 simplifier

@lotem
Copy link
Member

lotem commented Jan 25, 2023

聯繫到 simplifier 就看出了這種做法的問題。每個 filter 都要重複支持兩種機制。
filter 只檢查 tag 就夠了。segmenter 應根據開關狀態設置 tag。

@shewer
Copy link
Contributor Author

shewer commented Jan 26, 2023

沒有 這種 segmentor 哇

class FallbackSegmentor : public Segmentor {
class AsciiSegmentor : public Segmentor {
class AffixSegmentor : public Segmentor {
class AbcSegmentor : public Segmentor {
class PunctSegmentor : public Segmentor {
class Matcher : public Segmentor {

你是說 註冊一個 以option_name 打tag 的segmentor嗎
對segmentor 瞭解不熟,所以少從segmentor應用

@groverlynn
Copy link
Contributor

可是 recognizer 與matcher 須配合 input 才能打 tag 來切換反查filter recognizer 設置多反查tag pattern 複雜度高且因 recognizer 檢查pattern match 井非全部橙查 在N個translator + n個反查filter 情況下 要設定pattern 着實不昜 abc: trana: A[a-z]* tranb: B[a-z]*

reverse1: reverse2: 在patterns 和 tag extra_tags 設定上不容易操控, 時不時 還得 加上 affix_segmentor 拿掉前後綴字元

使用 option開關, 配合 switches 中 options 可以 在 tag 'abc ' 全時打開反查 及 切換反查字典 類似 simplifier

打開選單選擇反查字典(比如F4+5)不就相當於使用 `5作反查前綴嗎

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

Successfully merging this pull request may close these issues.

None yet

3 participants