📄 permute.cpp
字号:
/* -*-C-*- ******************************************************************************** * * File: permute.c (Formerly permute.c) * Description: Handle the new ratings choices for Wise Owl * Author: Mark Seaman, OCR Technology * Created: Fri Sep 22 14:05:51 1989 * Modified: Thu Jan 3 16:38:46 1991 (Mark Seaman) marks@hpgrlt * Language: C * Package: N/A * Status: Experimental (Do Not Distribute) * * (c) Copyright 1989, Hewlett-Packard Company. ** 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. * *********************************************************************************//*---------------------------------------------------------------------- I n c l u d e s---------------------------------------------------------------------*/#include "permute.h"#include "globals.h"#include "permdawg.h"#include "debug.h"#include "tordvars.h"#include "hyphen.h"#include "stopper.h"#include "trie.h"#include "context.h"#include "permnum.h"#include "freelist.h"#include "callcpp.h"#include <math.h>int permutation_count; // Used in metrics.cpp./*---------------------------------------------------------------------- V a r i a b l e s----------------------------------------------------------------------*/#define MAX_NUM_EDGES 60000#define MAX_DOC_EDGES 250000#define RESERVED_DOC_EDGES 10000#define MAX_USER_EDGES 20000#define USER_RESERVED_EDGES 2000 /* Weights for adjustment */#define NON_WERD 1.25#define GARBAGE_STRING 1.5#define MAX_PERM_LENGTH 128static EDGE_ARRAY pending_words;static EDGE_ARRAY document_words;static EDGE_ARRAY user_words;static EDGE_ARRAY word_dawg;make_toggle_var (adjust_debug, 0, make_adjust_debug,8, 13, set_adjust_debug, "Adjustment Debug");make_toggle_var (compound_debug, 0, make_compound_debug,8, 14, set_compound_debug, "Compound Debug");make_float_var (non_word, NON_WERD, make_non_word,8, 20, set_non_word, "Non-word adjustment");make_float_var (garbage, GARBAGE_STRING, make_garbage,8, 21, set_garbage, "Garbage adjustment");make_toggle_var (save_doc_words, 0, make_doc_words,8, 22, set_doc_words, "Save Document Words ");make_toggle_var (doc_dict_enable, 1, make_doc_dict,8, 25, set_doc_dict, "Enable Document Dictionary ");/* PREV DEFAULT 0 */int permute_only_top = 0; //0x0=.static INT32 bigram_counts[256][3] = { { 0, 0, 0 }, { //0x1=. 0, 0, 0 }, { //0x2=. 0, 0, 0 }, { //0x3=. 0, 0, 0 }, { //0x4=. 0, 0, 0 }, { //0x5=. 0, 0, 0 }, { //0x6=. 0, 0, 0 }, { //0x7=. 0, 0, 0 }, { //0x8=. 0, 0, 0 }, { //0x9=. 0, 0, 0 }, { //0xa=. 93, 28, 0 }, { //0xb=. 0, 0, 0 }, { //0xc=. 0, 0, 0 }, { //0xd=. 0, 0, 0 }, { //0xe=. 0, 0, 0 }, { //0xf=. 0, 0, 0 }, { //0x10=. 0, 0, 0 }, { //0x11=. 0, 0, 0 }, { //0x12=. 0, 0, 0 }, { //0x13=. 0, 0, 0 }, { //0x14=. 0, 0, 0 }, { //0x15=. 0, 0, 0 }, { //0x16=. 0, 0, 0 }, { //0x17=. 0, 0, 0 }, { //0x18=. 0, 0, 0 }, { //0x19=. 0, 0, 0 }, { //0x1a=. 0, 0, 0 }, { //0x1b=. 0, 0, 0 }, { //0x1c=. 0, 0, 0 }, { //0x1d=. 0, 0, 0 }, { //0x1e=. 0, 0, 0 }, { //0x1f=. 0, 0, 0 }, { //0x20= 324, 377, 2 }, { //0x21=! 2, 1, 0 }, { //0x22=" 2, 1, 0 }, { //0x23=# 1, 0, 1 }, { //0x24=$ 2, 1, 0 }, { //0x25=% 2, 0, 0 }, { //0x26=& 2, 1, 0 }, { //0x27=' 1, 21, 8 }, { //0x28=( 2, 1, 0 }, { //0x29=) 19, 0, 0 }, { //0x2a=* 2, 1, 0 }, { //0x2b=+ 1, 0, 0 }, { //0x2c=, 75, 4, 0 }, { //0x2d=- 52, 7, 0 }, { //0x2e=. 190, 16, 3 }, { //0x2f=/ 53, 2, 0 }, { //0x30=0 399, 0, 0 }, { //0x31=1 220, 0, 0 }, { //0x32=2 226, 0, 0 }, { //0x33=3 128, 0, 0 }, { //0x34=4 147, 0, 0 }, { //0x35=5 179, 0, 1 }, { //0x36=6 173, 0, 0 }, { //0x37=7 115, 0, 0 }, { //0x38=8 107, 0, 0 }, { //0x39=9 934, 0, 1 }, { //0x3a=: 27, 0, 1 }, { //0x3b=; 2, 1, 0 }, { //0x3c=< 2, 1, 0 }, { //0x3d== 2, 1, 0 }, { //0x3e=> 2, 1, 0 }, { //0x3f=? 2, 1, 0 }, { //0x40=@ 2, 1, 0 }, { //0x41=A 3, 1, 0 }, { //0x42=B 1, 73, 0 }, { //0x43=C 1, 6, 0 }, { //0x44=D 1, 24, 0 }, { //0x45=E 1, 2, 0 }, { //0x46=F 1, 19, 0 }, { //0x47=G 1, 2, 0 }, { //0x48=H 3, 2, 1 }, { //0x49=I 0, 68, 0 }, { //0x4a=J 1, 2, 0 }, { //0x4b=K 1, 2, 0 }, { //0x4c=L 1, 82, 0 }, { //0x4d=M 10, 10, 0 }, { //0x4e=N 3, 239, 0 }, { //0x4f=O 1, 10, 0 }, { //0x50=P 0, 1, 3 }, { //0x51=Q 2, 3, 0 }, { //0x52=R 1, 43, 0 }, { //0x53=S 1, 53, 0 }, { //0x54=T 2, 18, 0 }, { //0x55=U 1, 2, 0 }, { //0x56=V 1, 17, 0 }, { //0x57=W 1, 5, 0 }, { //0x58=X 1, 6, 0 }, { //0x59=Y 1, 2, 0 }, { //0x5a=Z 1, 2, 0 }, { //0x5b=[ 2, 1, 0 }, { //0x5c=backslash 2, 1, 0 }, { //0x5d=] 2, 1, 0 }, { //0x5e=^ 2, 1, 0 }, { //0x5f=_ 2, 1, 0 }, { //0x60=` 1, 0, 2 }, { //0x61=a 0, 0, 671 }, { //0x62=b 0, 1, 16 }, { //0x63=c 0, 2, 1 }, { //0x64=d 0, 14, 0 }, { //0x65=e 0, 0, 763 }, { //0x66=f 0, 186, 0 }, { //0x67=g 0, 2, 1 }, { //0x68=h 0, 2, 1 }, { //0x69=i 0, 0, 818 }, { //0x6a=j 0, 2, 1 }, { //0x6b=k 0, 4, 1 }, { //0x6c=l 0, 26, 3 }, { //0x6d=m 0, 69, 0 }, { //0x6e=n 0, 885, 0 }, { //0x6f=o 0, 17, 722 }, { //0x70=p 0, 1, 5 }, { //0x71=q 2, 1, 0 }, { //0x72=r 0, 21, 0 }, { //0x73=s 3, 49, 0 }, { //0x74=t 0, 219, 5 }, { //0x75=u 0, 0, 56 }, { //0x76=v 0, 4, 0 }, { //0x77=w 0, 2, 1 }, { //0x78=x 0, 2, 1 }, { //0x79=y 0, 1, 23 }, { //0x7a=z 0, 2, 1 }, { //0x7b={ 2, 1, 0 }, { //0x7c=| 59, 0, 3 }, { //0x7d=} 2, 1, 0 }, { //0x7e=~ 2, 1, 0 }, { //0x7f=. 0, 0, 0 }, { //0x80=. 0, 0, 0 }, { //0x81=. 0, 0, 0 }, { //0x82=. 0, 0, 0 }, { //0x83=. 0, 0, 0 }, { //0x84=. 0, 0, 0 }, { //0x85=. 0, 0, 0 }, { //0x86=. 0, 0, 0 }, { //0x87=. 0, 0, 0 }, { //0x88=. 0, 0, 0 }, { //0x89=. 0, 0, 0 }, { //0x8a=. 0, 0, 0 }, { //0x8b=. 0, 0, 0 }, { //0x8c=. 0, 0, 0 }, { //0x8d=. 0, 0, 0 }, { //0x8e=. 0, 0, 0 }, { //0x8f=. 0, 0, 0 }, { //0x90=. 0, 0, 0 }, { //0x91=. 0, 0, 0 }, { //0x92=. 0, 0, 0 }, { //0x93=. 0, 0, 0 }, { //0x94=. 0, 0, 0 },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -