Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	翻译成地道的中文
Browse files- core_functional.py +71 -0
    	
        core_functional.py
    ADDED
    
    | @@ -0,0 +1,71 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            # 'primary' 颜色对应 theme.py 中的 primary_hue
         | 
| 2 | 
            +
            # 'secondary' 颜色对应 theme.py 中的 neutral_hue
         | 
| 3 | 
            +
            # 'stop' 颜色对应 theme.py 中的 color_er
         | 
| 4 | 
            +
            # 默认按钮颜色是 secondary
         | 
| 5 | 
            +
            from toolbox import clear_line_break
         | 
| 6 | 
            +
             | 
| 7 | 
            +
             | 
| 8 | 
            +
            def get_core_functions():
         | 
| 9 | 
            +
                return {
         | 
| 10 | 
            +
                    "英语学术润色": {
         | 
| 11 | 
            +
                        # 前言
         | 
| 12 | 
            +
                        "Prefix":   r"Below is a paragraph from an academic paper. Polish the writing to meet the academic style, " +
         | 
| 13 | 
            +
                                    r"improve the spelling, grammar, clarity, concision and overall readability. When necessary, rewrite the whole sentence. " +
         | 
| 14 | 
            +
                                    r"Furthermore, list all modification and explain the reasons to do so in markdown table." + "\n\n",
         | 
| 15 | 
            +
                        # 后语
         | 
| 16 | 
            +
                        "Suffix":   r"",
         | 
| 17 | 
            +
                        "Color":    r"secondary",    # 按钮颜色
         | 
| 18 | 
            +
                    },
         | 
| 19 | 
            +
                    "中文学术润色": {
         | 
| 20 | 
            +
                        "Prefix":   r"作为一名中文学术论文写作改进助理,你的任务是改进所提供文本的拼写、语法、清晰、简洁和整体可读性," +
         | 
| 21 | 
            +
                                    r"同时分解长句,减少重复,并提供改进建议。请只提供文本的更正版本,避免包括解释。请编辑以下文本" + "\n\n",
         | 
| 22 | 
            +
                        "Suffix":   r"",
         | 
| 23 | 
            +
                    },
         | 
| 24 | 
            +
                    "查找语法错误": {
         | 
| 25 | 
            +
                        "Prefix":   r"Can you help me ensure that the grammar and the spelling is correct? " +
         | 
| 26 | 
            +
                                    r"Do not try to polish the text, if no mistake is found, tell me that this paragraph is good." +
         | 
| 27 | 
            +
                                    r"If you find grammar or spelling mistakes, please list mistakes you find in a two-column markdown table, " +
         | 
| 28 | 
            +
                                    r"put the original text the first column, " +
         | 
| 29 | 
            +
                                    r"put the corrected text in the second column and highlight the key words you fixed.""\n"
         | 
| 30 | 
            +
                                    r"Example:""\n"
         | 
| 31 | 
            +
                                    r"Paragraph: How is you? Do you knows what is it?""\n"
         | 
| 32 | 
            +
                                    r"| Original sentence | Corrected sentence |""\n"
         | 
| 33 | 
            +
                                    r"| :--- | :--- |""\n"
         | 
| 34 | 
            +
                                    r"| How **is** you? | How **are** you? |""\n"
         | 
| 35 | 
            +
                                    r"| Do you **knows** what **is** **it**? | Do you **know** what **it** **is** ? |""\n"
         | 
| 36 | 
            +
                                    r"Below is a paragraph from an academic paper. "
         | 
| 37 | 
            +
                                    r"You need to report all grammar and spelling mistakes as the example before."
         | 
| 38 | 
            +
                                    + "\n\n",
         | 
| 39 | 
            +
                        "Suffix":   r"",
         | 
| 40 | 
            +
                        "PreProcess": clear_line_break,    # 预处理:清除换行符
         | 
| 41 | 
            +
                    },
         | 
| 42 | 
            +
                    "中译英": {
         | 
| 43 | 
            +
                        "Prefix":   r"Please translate following sentence to English:" + "\n\n",
         | 
| 44 | 
            +
                        "Suffix":   r"",
         | 
| 45 | 
            +
                    },
         | 
| 46 | 
            +
                    "学术中英互译": {
         | 
| 47 | 
            +
                        "Prefix":   r"I want you to act as a scientific English-Chinese translator, " +
         | 
| 48 | 
            +
                                    r"I will provide you with some paragraphs in one language " +
         | 
| 49 | 
            +
                                    r"and your task is to accurately and academically translate the paragraphs only into the other language. " +
         | 
| 50 | 
            +
                                    r"Do not repeat the original provided paragraphs after translation. " +
         | 
| 51 | 
            +
                                    r"You should use artificial intelligence tools, " +
         | 
| 52 | 
            +
                                    r"such as natural language processing, and rhetorical knowledge " +
         | 
| 53 | 
            +
                                    r"and experience about effective writing techniques to reply. " +
         | 
| 54 | 
            +
                                    r"I'll give you my paragraphs as follows, tell me what language it is written in, and then translate:" + "\n\n",
         | 
| 55 | 
            +
                        "Suffix": "",
         | 
| 56 | 
            +
                        "Color": "secondary",
         | 
| 57 | 
            +
                    },
         | 
| 58 | 
            +
                    "英译中": {
         | 
| 59 | 
            +
                        "Prefix":   r"翻译成地道的中文:" + "\n\n",
         | 
| 60 | 
            +
                        "Suffix":   r"",
         | 
| 61 | 
            +
                    },
         | 
| 62 | 
            +
                    "找图片": {
         | 
| 63 | 
            +
                        "Prefix":   r"我需要你找一张网络图片。使用Unsplash API(https://source.unsplash.com/960x640/?<英语关键词>)获取图片URL," +
         | 
| 64 | 
            +
                                    r"然后请使用Markdown格式封装,并且不要有反斜线,不要用代码块。现在,请按以下描述给我发送图片:" + "\n\n",
         | 
| 65 | 
            +
                        "Suffix":   r"",
         | 
| 66 | 
            +
                    },
         | 
| 67 | 
            +
                    "解释代码": {
         | 
| 68 | 
            +
                        "Prefix":   r"请解释以下代码:" + "\n```\n",
         | 
| 69 | 
            +
                        "Suffix":   "\n```\n",
         | 
| 70 | 
            +
                    },
         | 
| 71 | 
            +
                }
         |