MCPcopy Create free account

hub / github.com/discus0434/pdf-translator / functions

Functions383 in github.com/discus0434/pdf-translator

↓ 15 callersMethodget
(self, extras=None)
utils/ocr_model/ppocr_onnx/ppocr/utils/stats.py:56
↓ 15 callersMethodrun
Run the API server
server/main.py:76
↓ 14 callersMethod__init__
(self, character_dict_path=None, use_space_char=False, **kw
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:805
↓ 11 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:813
↓ 7 callersFunctionget_logger
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 handl
utils/ocr_model/ppocr_onnx/ppocr/utils/logging.py:28
↓ 6 callersFunctionsort_part_with_direction
(pos_list, point_direction)
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py:163
↓ 6 callersFunctionsort_part_with_direction
(pos_list, point_direction)
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:185
↓ 5 callersFunctionintersection
Intersection.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/locality_aware_nms.py:10
↓ 4 callersFunctioncheck_and_read
(img_path)
utils/ocr_model/ppocr_onnx/ppocr/utils/utility.py:74
↓ 4 callersFunctioncolumn_width
Return the column width of text. Correct ``len(text)`` for wide East Asian and combining Unicode chars.
utils/textwrap_japanese.py:22
↓ 4 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:705
↓ 4 callersFunctionget_image_file_list
(img_file)
utils/ocr_model/ppocr_onnx/ppocr/utils/utility.py:55
↓ 4 callersFunctionin_contour
(cont, point)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:186
↓ 4 callersFunctionsort_with_direction
f_direction: h x w x 2 pos_list: [[y, x], [y, x], [y, x] ...]
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:179
↓ 4 callersMethodupdate
(self, stats)
utils/ocr_model/ppocr_onnx/ppocr/utils/stats.py:49
↓ 3 callersMethod__init__
(self, size=None, size_div=32, **kwargs)
utils/ocr_model/ppocr_onnx/ppocr/data/imaug/operators.py:134
↓ 3 callersFunctionadd_id
Add id for gather feature, for inference.
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:218
↓ 3 callersFunctionarea_of
Compute the areas of rectangles given two corners. Args: left_top (N, 2): left top corner. right_bottom (N, 2): right bottom corne
utils/ocr_model/ppocr_onnx/ppocr/postprocess/picodet_postprocess.py:69
↓ 3 callersFunctionbuild_post_process
(config, global_config=None)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/__init__.py:43
↓ 3 callersFunctioncreate_blank_img
()
utils/ocr_model/ppocr_onnx/tools/infer/utility.py:423
↓ 3 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:258
↓ 3 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:446
↓ 3 callersFunctiondraw_box_txt
(bbox, text, draw, font, font_size, color)
utils/ocr_model/ppocr_onnx/ppocr/utils/visual.py:58
↓ 3 callersMethodget_ignored_tokens
(self)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:316
↓ 3 callersMethodget_mini_boxes
(self, contour)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py:157
↓ 3 callersFunctionget_rotate_crop_image
img_height, img_width = img.shape[0:2] left = int(np.min(points[:, 0])) right = int(np.max(points[:, 0])) top = int(np.min(points[:,
utils/ocr_model/ppocr_onnx/tools/infer/utility.py:498
↓ 3 callersFunctionpoly_nms
(polygons, threshold)
utils/ocr_model/ppocr_onnx/ppocr/utils/poly_nms.py:127
↓ 3 callersFunctionvalid_boundary
(x, with_score=True)
utils/ocr_model/ppocr_onnx/ppocr/utils/poly_nms.py:78
↓ 2 callersMethod__call__
(self, preds, label=None, length=None, *args, **kwargs)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:841
↓ 2 callersMethod_bbox_decode
(self, bbox, shape)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py:133
↓ 2 callersFunction_check_image_file
(path)
utils/ocr_model/ppocr_onnx/ppocr/utils/utility.py:50
↓ 2 callersMethodbox_score_fast
box_score_fast: use bbox mean score as the mean score
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py:180
↓ 2 callersMethodclip_det_res
(self, points, img_height, img_width)
utils/ocr_model/ppocr_onnx/tools/infer/predict_det.py:177
↓ 2 callersFunctioncreate_font
(txt, sz, font_path="./doc/fonts/simfang.ttf")
utils/ocr_model/ppocr_onnx/tools/infer/utility.py:369
↓ 2 callersFunctioncreate_operators
create operators based on the config Args: params(list): a dict list, used to create some operators
utils/ocr_model/ppocr_onnx/ppocr/data/imaug/__init__.py:33
↓ 2 callersFunctionctc_decoder_for_image
CTC decoder using multiple processes.
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:166
↓ 2 callersMethoddecode
convert text-label into text-index.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py:61
↓ 2 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:177
↓ 2 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:363
↓ 2 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:518
↓ 2 callersMethoddecode
convert text-index into text-label.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:625
↓ 2 callersMethoddecode
(self, text_index, preds_prob=None)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:916
↓ 2 callersMethodget_beg_end_flag_idx
(self, beg_or_end)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:231
↓ 2 callersMethodget_beg_end_flag_idx
(self, beg_or_end)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:321
↓ 2 callersMethodget_beg_end_flag_idx
(self, beg_or_end)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:483
↓ 2 callersMethodget_ignored_tokens
(self)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py:165
↓ 2 callersMethodget_ignored_tokens
(self)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:226
↓ 2 callersFunctionget_minarea_rect_crop
(img, points)
utils/ocr_model/ppocr_onnx/tools/infer/utility.py:530
↓ 2 callersFunctionis_link
(s)
utils/ocr_model/ppocr_onnx/ppocr/utils/network.py:70
↓ 2 callersFunctionnms_locality
locality aware nms of EAST :param polys: a N*9 numpy array. first 8 coordinates, then prob :return: boxes after nms
utils/ocr_model/ppocr_onnx/ppocr/postprocess/locality_aware_nms.py:173
↓ 2 callersFunctionnorm2
(x, axis=None)
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/visual.py:155
↓ 2 callersFunctionnorm2
(point1, point2)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:137
↓ 2 callersFunctionpoints2polygon
Convert k points to 1 polygon. Args: points (ndarray or list): A ndarray or a list of shape (2k) that indicates k points.
utils/ocr_model/ppocr_onnx/ppocr/utils/poly_nms.py:19
↓ 2 callersFunctionpoly_intersection
Calculate the intersection area between two polygon. Args: poly_det (Polygon): A polygon predicted by detector. poly_gt (Polygon)
utils/ocr_model/ppocr_onnx/ppocr/utils/poly_nms.py:39
↓ 2 callersMethodresize_norm_img_sar
(self, img, image_shape, w
utils/ocr_model/ppocr_onnx/tools/infer/predict_rec.py:277
↓ 2 callersFunctionshrink_quad_along_width
(quad, begin_width_ratio=0., end_width_ratio=1.)
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py:311
↓ 2 callersFunctionshrink_quad_along_width
Generate shrink_quad_along_width.
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/visual.py:117
↓ 2 callersFunctionshrink_quad_along_width
Generate shrink_quad_along_width.
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:58
↓ 2 callersMethodshrink_quad_along_width
Generate shrink_quad_along_width.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/sast_postprocess.py:67
↓ 2 callersFunctionsort_and_expand_with_direction_v2
f_direction: h x w x 2 pos_list: [[y, x], [y, x], [y, x] ...] binary_tcl_map: h x w
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_slow.py:270
↓ 2 callersFunctionsort_with_direction
f_direction: h x w x 2 pos_list: [[y, x], [y, x], [y, x] ...]
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py:157
↓ 2 callersFunctiontransform
transform
utils/ocr_model/ppocr_onnx/ppocr/data/imaug/__init__.py:22
↓ 2 callersFunctiontranslate_request
Sends a POST request to the translator server to translate a PDF. Parameters ---------- input_pdf_path : Path Path to the PDF to
cli.py:11
↓ 2 callersMethodunclip
(self, box, unclip_ratio)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py:149
↓ 1 callersMethod__get_paddleocr_parameters
Get parameters for PaddleOCR. Parameters ---------- model_root_dir : Path Path to the PaddleOCR model ro
utils/ocr_model/ocr_model.py:52
↓ 1 callersMethod__init__
Initialize OCR model. Parameters ---------- model_root_dir : Path Path to the PaddleOCR model root direc
utils/ocr_model/ocr_model.py:15
↓ 1 callersMethod__init__
(self, character_dict_path, merge_no_span_structure=False,
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py:22
↓ 1 callersMethod__init__
(self, class_path, model_name=["Student"], key=None, **kwargs)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_ser_layoutlm_postprocess.py:100
↓ 1 callersMethod__init__
(self, model_name=["Student"], key=None, **kwargs)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py:78
↓ 1 callersMethod__load_models
Backend function for loading models. Called in the constructor. Load the layout model, OCR model, translation model and font.
server/main.py:163
↓ 1 callersMethod__merge_pdfs
Merge translated PDF files into one file. Merged file will be stored in the temp directory as "translated.pdf". Parameters
server/main.py:355
↓ 1 callersMethod__split_text
Split text into chunks of sentences within text_limit. Parameters ---------- text: str Text to be split.
server/main.py:317
↓ 1 callersMethod__translate
Translate text using the translation model. If the text is too long, it will be splited with the heuristic that each sentence should
server/main.py:284
↓ 1 callersMethod__translate_one_page
Translate one page of the PDF file. There are some heuristics to clean-up the results of translation: 1. Remove newlines, tabs, b
server/main.py:195
↓ 1 callersMethod_break_word
_break_word(word : string, space_left : int) -> (string, string) Break line by unicode width instead of len(word).
utils/textwrap_japanese.py:87
↓ 1 callersMethod_calculate_iou
(self, box1: tuple[float, ...], box2: tuple[float, ...])
utils/layout_model.py:98
↓ 1 callersMethod_get_boundary_single
(self, score_map, scale)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/fce_postprocess.py:139
↓ 1 callersMethod_get_image
(self, image: np.ndarray, bbox: tuple[float, ...])
utils/layout_model.py:74
↓ 1 callersMethod_handle_long_word
_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
utils/textwrap_japanese.py:115
↓ 1 callersMethod_infer
(self, preds, segment_offset_ids, ocr_infos)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_ser_layoutlm_postprocess.py:66
↓ 1 callersMethod_infer
(self, pred_relations, *args, **kwargs)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py:35
↓ 1 callersMethod_load_model
( self, model_root_dir: Path, device: str = "cuda" )
utils/layout_model.py:88
↓ 1 callersMethod_metric
(self, preds, label)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_ser_layoutlm_postprocess.py:52
↓ 1 callersMethod_metric
(self, pred_relations, label)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/vqa_token_re_layoutlm_postprocess.py:32
↓ 1 callersFunction_mkdir_if_not_exist
mkdir if not exists, ignore the exception when multiprocess mkdir together
utils/ocr_model/ppocr_onnx/ppocr/utils/save_load.py:31
↓ 1 callersMethod_parse_from_string
(self, options_str)
utils/ocr_model/ppocr_onnx/ppocr/utils/profiler.py:59
↓ 1 callersMethod_remove_overlapping_layouts
(self, layouts: list[Layout])
utils/layout_model.py:50
↓ 1 callersMethod_translate_pdf
Backend function for translating PDF files. Translation is performed in the following steps: 1. Convert the PDF file to images
server/main.py:107
↓ 1 callersMethodadd_link
(self, link_node)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:40
↓ 1 callersMethodadd_special_char
(self, dict_character)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/table_postprocess.py:154
↓ 1 callersMethodadd_special_char
(self, dict_character)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/rec_postprocess.py:64
↓ 1 callersMethodadd_value
(self, value)
utils/ocr_model/ppocr_onnx/ppocr/utils/stats.py:30
↓ 1 callersFunctionboundary_iou
Calculate the IOU between two boundaries. Args: src (list): Source boundary. target (list): Target boundary. Returns: i
utils/ocr_model/ppocr_onnx/ppocr/utils/poly_nms.py:90
↓ 1 callersMethodbox_score_slow
box_score_slow: use polyon mean score as the mean score
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py:197
↓ 1 callersMethodboxes_from_bitmap
_bitmap: single map with shape (1, H, W), whose values are binarized as {0, 1}
utils/ocr_model/ppocr_onnx/ppocr/postprocess/db_postprocess.py:102
↓ 1 callersMethodcluster_by_quads_tco
Cluster pixels in tcl_map based on quads.
utils/ocr_model/ppocr_onnx/ppocr/postprocess/sast_postprocess.py:145
↓ 1 callersFunctionclusters2labels
(clusters, num_nodes)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:106
↓ 1 callersFunctioncomps2boundaries
(text_comps, comp_pred_labels)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:219
↓ 1 callersFunctionconnected_components
(nodes, score_dict, link_thr)
utils/ocr_model/ppocr_onnx/ppocr/postprocess/drrg_postprocess.py:80
↓ 1 callersFunctionctc_decoder_for_image
CTC decoder using multiple processes.
utils/ocr_model/ppocr_onnx/ppocr/utils/e2e_utils/extract_textpoint_fast.py:131
next →1–100 of 383, ranked by callers