CN105160033B - The processing method and processing device of expression character string - Google Patents
The processing method and processing device of expression character string Download PDFInfo
- Publication number
- CN105160033B CN105160033B CN201510642793.1A CN201510642793A CN105160033B CN 105160033 B CN105160033 B CN 105160033B CN 201510642793 A CN201510642793 A CN 201510642793A CN 105160033 B CN105160033 B CN 105160033B
- Authority
- CN
- China
- Prior art keywords
- expression
- picture
- mapping relationship
- single code
- processing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Document Processing Apparatus (AREA)
- Mathematical Physics (AREA)
- Library & Information Science (AREA)
Abstract
本发明提供了一种表情字符串的处理方法及装置,包括:对于具备图片表情‑表情字符串的第一映射关系的图片表情,在第一映射关系的基础上,增加表情字符串与单一码unicode的第二映射关系,结合第一映射关系和第二映射关系,以在图片表情和单一码间建立对应映射关系,接收到某个图片表情的处理消息时,利用在图片表情和单一码间建立的对应映射关系,查找到与该图片表情对应的单一码,对查找到的单一码执行处理消息中携带的处理操作。采用本发明能够解决图片表情处理操作时需要执行多次才能完成的问题。
The present invention provides a method and device for processing emoticon character strings, including: for image emoticons having a first mapping relationship of image expression-expression character strings, on the basis of the first mapping relationship, adding expression character strings and a single code The second mapping relationship of unicode, combining the first mapping relationship and the second mapping relationship, to establish a corresponding mapping relationship between the picture expression and the single code, when receiving the processing message of a certain picture expression, use it between the picture expression and the single code Based on the established corresponding mapping relationship, the single code corresponding to the picture expression is found, and the processing operation carried in the processing message is performed on the found single code. The invention can solve the problem that the image expression processing operation needs to be performed many times before it can be completed.
Description
技术领域technical field
本发明涉及计算机技术领域,特别是涉及一种表情字符串的处理方法及装置。The invention relates to the field of computer technology, in particular to a method and device for processing emoticon character strings.
背景技术Background technique
Emoji词义来自日语えもじ,在日语中的含义是字符,是日本在无线通信中所使用的视觉情感符号,在苹果公司发布的IOS 5输入法引入了Emoji之后,这种表情符号逐渐流行起来。目前,图片表情几乎在所有的移动聊天软件得到了广泛地应用,比如微信、易信、QQ都支持表情的发送。图片表情本质上是一个符合特定格式的字符串,大多的实现方案都是将图片表情和其所对应的字符串建立一层对应关系,比如"[:smile]"对应着“微笑”表情,"[:cry]"对应着“哭泣”表情。The meaning of Emoji comes from Japanese えもじ, which means characters in Japanese. It is a visual emotional symbol used in wireless communication in Japan. After the introduction of Emoji in the IOS 5 input method released by Apple, this kind of emoticon gradually became popular. At present, picture emoticons have been widely used in almost all mobile chat software, such as WeChat, Yixin, and QQ all support the sending of emoticons. A picture emoticon is essentially a character string conforming to a specific format. Most of the implementation schemes establish a correspondence between the picture emoticon and its corresponding string, for example, "[:smile]" corresponds to the "smiling" emoticon, " [:cry]" corresponds to the "cry" emoji.
操作系统自带的TextView控件具有强大的图文混排处理能力,它主要通过图文混排函数SpannableString方便地实现文本到图片表情的转换,可以将制定范围内的文字替换为Emoji表情,但是虽然指定范围内显示的是表情,实际上TextView控件内部保存的仍旧是原始的字符串,即图片表情与字符串被视为两个单独的个体存在,导致某些应用(例如输入法)进行图片表情处理时,需要对该图片表情执行多次才能完成操作。例如,图1示出了现有技术中客户端输入图片表情的一个示例图,图1中排在第2位的图片表情需要删除,图2示出了现有技术中客户端进行图片表情删除后出现表情编码的一个示例图,由图2可以看出,删除图片表情之后,后台的原始字符串“/::”仍然存在,并显示在客户端的界面中,若需要将“/::”删除,则需要二次进行删除操作。The TextView control that comes with the operating system has a powerful image-text mixing processing capability. It mainly uses the image-text mixing function SpannableString to conveniently convert text to image expressions, and can replace text within the specified range with Emoji expressions, but although Emoticons are displayed within the specified range. In fact, the original strings are still stored inside the TextView control, that is, the image emoticons and strings are regarded as two separate entities, which causes some applications (such as input methods) to display image emoticons. During processing, it is necessary to execute the image emoticon multiple times to complete the operation. For example, Figure 1 shows an example diagram of the client inputting a picture emoticon in the prior art, the picture emoticon ranked second in Figure 1 needs to be deleted, and Figure 2 shows that the client performs picture emoticon deletion in the prior art An example picture of emoticon coding appears afterward. It can be seen from Figure 2 that after deleting the picture emoticon, the original string "/::" in the background still exists and is displayed on the client interface. If you need to replace "/::" If you want to delete, you need to perform the delete operation twice.
由此可以看出,现有技术中,图片表情处理操作可能需要多次操作才能够完成,操作次数的增多会浪费相应的资源,同时也增加了操作难度。It can be seen from this that in the prior art, the image expression processing operation may require multiple operations to complete, and the increase in the number of operations will waste corresponding resources and also increase the difficulty of the operation.
发明内容Contents of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的表情字符串的处理方法及装置。In view of the above problems, the present invention is proposed to provide a method and device for processing emoticon character strings that overcome the above problems or at least partially solve the above problems.
基于本发明的一个方面,提供了一种表情字符串的处理方法,包括:Based on one aspect of the present invention, a method for processing emoticon character strings is provided, including:
对于具备图片表情-表情字符串的第一映射关系的图片表情,在所述第一映射关系的基础上,增加表情字符串与单一码unicode的第二映射关系;For the picture expression with the first mapping relationship of picture expression-expression string, on the basis of the first mapping relationship, increase the second mapping relationship between expression string and single code unicode;
结合所述第一映射关系和所述第二映射关系,以在所述图片表情和所述单一码间建立对应映射关系。Combining the first mapping relationship and the second mapping relationship to establish a corresponding mapping relationship between the picture expression and the single code.
可选地,还包括:Optionally, also include:
接收到某个图片表情的处理消息时,利用在所述图片表情和所述单一码间建立的对应映射关系,查找到与该图片表情对应的单一码;When receiving the processing message of a certain picture expression, use the corresponding mapping relationship established between the picture expression and the single code to find the single code corresponding to the picture expression;
对查找到的单一码执行所述处理消息中携带的处理操作。The processing operation carried in the processing message is performed on the found unique code.
可选地,利用在所述图片表情和所述单一码间建立的对应映射关系,查找到与该图片表情对应的单一码,包括:Optionally, using the corresponding mapping relationship established between the picture expression and the single code to find the single code corresponding to the picture expression, including:
根据所述第一映射关系,查找到该图片表情对应的表情字符串;According to the first mapping relationship, find the emoticon character string corresponding to the emoticon in the picture;
进而,根据所述第二映射关系,查找到与该表情字符串对应的单一码。Furthermore, according to the second mapping relationship, a unique code corresponding to the emoticon character string is found.
可选地,对查找到的单一码执行所述处理消息中携带的处理操作,包括:Optionally, performing the processing operation carried in the processing message on the found unique code includes:
调用与所述处理消息对应的处理函数;calling a processing function corresponding to the processing message;
利用所述处理函数设置所述单一码与所述图片表情位图间的转换关系;Using the processing function to set the conversion relationship between the single code and the picture expression bitmap;
利用所述处理函数对所述单一码执行所述处理消息中携带的处理操作,并利用所述单一码与所述图片表情位图间的转换关系将所述处理操作映射到所述图片表情位图。Using the processing function to execute the processing operation carried in the processing message on the single code, and using the conversion relationship between the single code and the picture expression bitmap to map the processing operation to the picture expression bitmap picture.
可选地,在包括至少一个所述图片表情的文本输入结束后,按如下步骤将该文本上传至服务器:Optionally, after the text input including at least one said picture emoticon is finished, the text is uploaded to the server according to the following steps:
获取所述文本的文本内容;Get the text content of said text;
解析出其中的单一码,利用表情库中存储的单一码与表情字符串的逆向映射关系查找到对应的表情字符串;Parsing out the single code, using the reverse mapping relationship between the single code stored in the expression library and the expression string to find the corresponding expression string;
使用查找出的对应的表情字符串替换所述单一码在所述文本中的位置;Replace the position of the unicode in the text with the corresponding emoticon character string found;
将替换结束得到的文本上传至服务器。Upload the text obtained after the replacement to the server.
基于本发明的另一方面,还提供了一种表情字符串的处理装置,包括:Based on another aspect of the present invention, a processing device for emoticon character strings is also provided, including:
增加模块,适于对于具备图片表情-表情字符串的第一映射关系的图片表情,在所述第一映射关系的基础上,增加表情字符串与单一码unicode的第二映射关系;Adding a module, suitable for the picture expression with the first mapping relationship of picture expression-expression string, on the basis of the first mapping relationship, increasing the second mapping relationship between expression string and single code unicode;
建立模块,适于结合所述第一映射关系和所述第二映射关系,以在所述图片表情和所述单一码间建立对应映射关系。The establishment module is adapted to combine the first mapping relationship and the second mapping relationship to establish a corresponding mapping relationship between the picture expression and the single code.
可选地,还包括:Optionally, also include:
查找模块,适于接收到某个图片表情的处理消息时,利用在所述图片表情和所述单一码间建立的对应映射关系,查找到与该图片表情对应的单一码;The search module is adapted to find the single code corresponding to the picture expression by using the corresponding mapping relationship established between the picture expression and the single code when receiving the processing message of a certain picture expression;
处理模块,适于对查找到的单一码执行所述处理消息中携带的处理操作。The processing module is adapted to execute the processing operation carried in the processing message on the found unique code.
可选地,所述查找模块还适于:Optionally, the search module is also suitable for:
根据所述第一映射关系,查找到该图片表情对应的表情字符串;According to the first mapping relationship, find the emoticon character string corresponding to the emoticon in the picture;
进而,根据所述第二映射关系,查找到与该表情字符串对应的单一码。Furthermore, according to the second mapping relationship, a unique code corresponding to the emoticon character string is found.
可选地,所述查找模块还适于:Optionally, the search module is also suitable for:
调用与所述处理消息对应的处理函数;calling a processing function corresponding to the processing message;
利用所述处理函数设置所述单一码与所述图片表情位图间的转换关系;Using the processing function to set the conversion relationship between the single code and the picture expression bitmap;
利用所述处理函数对所述单一码执行所述处理消息中携带的处理操作,并利用所述单一码与所述图片表情位图间的转换关系将所述处理操作映射到所述图片表情位图。Using the processing function to execute the processing operation carried in the processing message on the single code, and using the conversion relationship between the single code and the picture expression bitmap to map the processing operation to the picture expression bitmap picture.
可选地,还包括:Optionally, also include:
上传模块,适于在包括至少一个所述图片表情的文本输入结束后,按如下步骤将该文本上传至服务器:The upload module is suitable for uploading the text to the server according to the following steps after the text input including at least one said picture emoticon is completed:
获取所述文本的文本内容;Get the text content of said text;
解析出其中的单一码,利用表情库中存储的单一码与表情字符串的逆向映射关系查找到对应的表情字符串;Parsing out the single code, using the reverse mapping relationship between the single code stored in the expression library and the expression string to find the corresponding expression string;
使用查找出的对应的表情字符串替换所述单一码在所述文本中的位置;Replace the position of the unicode in the text with the corresponding emoticon character string found;
将替换结束得到的文本上传至服务器。Upload the text obtained after the replacement to the server.
本发明实施例提供了一种表情字符串的处理方法及装置,由于图片表情与表情字符串的第一映射关系在用于识别图片表情时存在一定的漏洞,导致图片表情与表情字符串可能会被视为两个单独的个体存在,此时,若需要对表情进行处理,可能需要得执行多次才能完成处理,为解决这一技术问题,本发明增加了表情字符串与unicode的第二映射关系,unicode是一种在计算机上使用的国际标准编码,能够用统一并且唯一的二进制编码表示世界上所有的书写语言中可能用于电脑通讯的字元、象形文字和其他符号,即,unicode具备唯一性。正是因为unicode具备唯一性,使得图片表情、表情字符串与unicode三者间建立的映射关系也具有唯一性,此时若对图片表情进行处理,通过具备唯一性的映射关系中的任意一个元素可以查找到其他两个元素,从而使得图片表情的操作也具备唯一性,对任意一个元素进行操作时,均能够根据图片表情、表情字符串与unicode三者间建立的具备唯一性的映射关系,将涉及到的其他两个元素进行处理,因此能够保证一次完成图片表情处理,从而避免了一个表情处理需要多次操作所导致的时间缓慢、资源浪费、用户感受体验较差等问题。Embodiments of the present invention provide a method and device for processing expression strings. Since the first mapping relationship between image expressions and expression strings has certain loopholes when used to identify image expressions, the image expressions and expression strings may be It is regarded as two separate individuals. At this time, if the expression needs to be processed, it may need to be executed multiple times to complete the processing. To solve this technical problem, the present invention adds a second mapping between expression strings and unicode Relationship, unicode is an international standard encoding used on computers, which can represent characters, pictographs and other symbols that may be used for computer communication in all written languages in the world with a unified and unique binary encoding, that is, unicode has uniqueness. It is precisely because of the uniqueness of unicode that the mapping relationship established between the picture expression, the expression string and unicode is also unique. At this time, if the picture expression is processed, any element in the unique mapping relationship The other two elements can be found, so that the operation of the picture expression is also unique. When operating any element, it can be based on the unique mapping relationship established between the picture expression, expression string and unicode. The other two elements involved are processed, so the image expression processing can be completed at one time, thereby avoiding problems such as slow time, waste of resources, and poor user experience caused by multiple operations for one expression processing.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.
根据下文结合附图对本发明具体实施例的详细描述,本领域技术人员将会更加明了本发明的上述以及其他目的、优点和特征。Those skilled in the art will be more aware of the above and other objects, advantages and features of the present invention according to the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings.
附图说明Description of drawings
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:
图1示出了现有技术中客户端输入图片表情的一个示例图;Fig. 1 shows an example diagram of a client inputting a picture emoticon in the prior art;
图2示出了现有技术中客户端进行图片表情删除后出现表情编码的一个示例图;Fig. 2 shows an example diagram of emoticon coding after the client deletes the image emoticon in the prior art;
图3示出了根据本发明一个实施例的表情字符串的处理方法的处理流程图;Fig. 3 shows the processing flowchart of the processing method of emoticon character string according to one embodiment of the present invention;
图4示出了根据本发明一个实施例的图片表情、表情字符串及单一码的映射关系示意图;Fig. 4 shows a schematic diagram of the mapping relationship between picture emoticons, emoticon character strings and single codes according to one embodiment of the present invention;
图5示出了根据本发明一个实施例的图片表情的处理方式的处理流程图;FIG. 5 shows a processing flow chart of a processing method of picture emoticons according to an embodiment of the present invention;
图6示出了根据本发明一个实施例的包括至少一个图片表情的文本输入结束后,将该文本上传至服务器的处理流程图;Fig. 6 shows a flow chart of uploading the text to the server after the text input including at least one picture emoticon is finished according to one embodiment of the present invention;
图7示出了根据本发明一个实施例的图片表情、表情字符串及单一码的结合逆向映射关系示意图;Fig. 7 shows a schematic diagram of the combined reverse mapping relationship of picture emoticons, emoticon character strings and single codes according to one embodiment of the present invention;
图8示出了根据本发明一个实施例的表情字符串的处理装置的结构示意图;FIG. 8 shows a schematic structural diagram of an emoticon character string processing device according to an embodiment of the present invention;
图9示出了根据本发明一个实施例的表情字符串的处理装置的另一种结构示意图;FIG. 9 shows another schematic structural diagram of an emoticon character string processing device according to an embodiment of the present invention;
图10示出了根据本发明一个实施例的表情字符串的处理装置的另一种结构示意图;以及FIG. 10 shows another schematic structural diagram of an emoticon character string processing device according to an embodiment of the present invention; and
图11示出了根据本发明一个优选实施例的多客户端间消息传输的系统示意图。Fig. 11 shows a schematic diagram of a system for message transmission among multiple clients according to a preferred embodiment of the present invention.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
为解决上述技术问题,本发明实施例提供了一种表情字符串的处理方法。图3示出了根据本发明一个实施例的表情字符串的处理方法的处理流程图。参见图3,该方法至少包括以下步骤S302至步骤S304。In order to solve the above technical problem, an embodiment of the present invention provides a method for processing emoticon character strings. Fig. 3 shows a processing flowchart of a method for processing emoticon character strings according to an embodiment of the present invention. Referring to Fig. 3, the method at least includes the following steps S302 to S304.
首先,执行步骤S302,对于具备图片表情与表情字符串的第一映射关系的图片表情,在第一映射关系的基础上,增加表情字符串与单一码(unicode)的第二映射关系。Firstly, step S302 is executed, and for the picture expression having the first mapping relationship between picture expression and expression character string, on the basis of the first mapping relationship, a second mapping relationship between expression character string and unicode (unicode) is added.
需要说明地是,在本发明实施例中,图片表情与表情字符串的第一映射关系是表情库中的现有映射关系,正在因为第一映射关系的识别性有一定的漏洞,导致图片表情和表情字符串可能会被视为两个单独的个体存在,进而需要执行多次才能够完成图片表情的处理。为解决这一技术问题,本发明实施例对第一映射关系进行改进,在第一映射关系的基础上,增加了第二映射关系,即表情字符串与单一码之间的映射关系。It should be noted that, in the embodiment of the present invention, the first mapping relationship between picture emoticons and expression character strings is an existing mapping relationship in the expression library, and because of certain loopholes in the recognition of the first mapping relationship, the picture expression and the emoticon string may be regarded as two separate entities, and then it needs to be executed multiple times to complete the processing of the image emoticon. To solve this technical problem, the embodiment of the present invention improves the first mapping relationship, and adds a second mapping relationship on the basis of the first mapping relationship, that is, the mapping relationship between emoticon character strings and unique codes.
具体地,在一个实施例中,设置一个Emoji表情库,该表情库包含常用图片表情,同时该Emoji表情库中存储有图片表情和其对应字符串的第一映射关系,此外,该Emoji类所有图片表情可以保存在类目录(例如:assets目录)中。Specifically, in one embodiment, an Emoji expression storehouse is set, and this expression storehouse contains commonly used picture expression, and stores the first mapping relation of picture expression and its corresponding character string in this Emoji expression storehouse simultaneously, in addition, this Emoji class all Image emoticons can be saved in class directories (for example: assets directory).
根据步骤S302提及的增加表情字符串与unicode的第二映射关系对本实施例的Emoji表情库中的表情字符串进行处理,为其设置对应的unicode。需要注意地是,unicode是一种在计算机上使用的国际标准编码,能够用统一并且唯一的二进制编码表示世界上所有的书写语言中可能用于电脑通讯的字元、象形文字和其他符号。正是因为unicode具备唯一性,使得图片表情、表情字符串与unicode三者间建立的映射关系也具有唯一性,这样每个图片表情都可以用一个唯一的字符表示。执行程序时,因后台默认unicode的唯一性和三者建立的映射关系的唯一性,通过具备唯一性的映射关系中的任意一个元素可以查找到其他两个元素,从而使得图片表情的操作也具备唯一性,对任意一个元素进行操作时,均能够根据图片表情、表情字符串与unicode三者间建立的具备唯一性的映射关系,将涉及到的其他两个元素进行处理,能够保证一次完成图片表情处理,从而避免了一个表情处理需要多次操作所导致的时间缓慢、资源浪费、用户感受体验较差等问题。进一步,为保证整个Emoji表情库的所有表情都不会出现多次处理才能够完成一个处理需求的情况,优选地,可以将整个Emoji表情库的全部图片表情均增设第二映射关系,使表情库中的每个图片表情均可以映射到唯一的unicode,对表情库中的任一图片表情进行处理时,因unicode的唯一性及三者建立的映射关系的唯一性,各图片表情的操作处理均能一次完成。According to the second mapping relationship between emoticon character strings and unicode mentioned in step S302, the emoticon character strings in the Emoji expression library of this embodiment are processed, and the corresponding unicode is set for them. It should be noted that unicode is an international standard encoding used on computers, which can represent characters, pictographs and other symbols that may be used for computer communication in all written languages in the world with a unified and unique binary code. It is precisely because of the uniqueness of unicode that the mapping relationship established between the picture expression, the expression string and unicode is also unique, so that each picture expression can be represented by a unique character. When executing the program, due to the uniqueness of the default unicode in the background and the uniqueness of the mapping relationship established by the three, the other two elements can be found through any element in the unique mapping relationship, so that the operation of the picture expression is also available. Uniqueness. When operating on any element, the other two elements involved can be processed according to the unique mapping relationship established between the picture expression, expression string and unicode, which can ensure that the picture is completed at one time. Expression processing, thereby avoiding problems such as time slowness, resource waste, and poor user experience caused by multiple operations for one expression processing. Further, in order to ensure that all the expressions in the entire Emoji expression library will not be processed multiple times to complete a processing requirement, preferably, all the picture expressions in the entire Emoji expression library can be added with a second mapping relationship, so that the expression library Each picture expression in the library can be mapped to a unique unicode. When processing any picture expression in the expression database, due to the uniqueness of unicode and the uniqueness of the mapping relationship established by the three, the operation and processing of each picture expression are uniform. Can be done in one go.
其中,本发明实施例将增设的单一码设置于客户端的空白区域,使其充分利用客户端的空白区域,并使得增设的单一码清楚简洁,其增设的映射关系也容易获取,避免与其他已有代码混淆在同一区域,导致代码叠加所造成的混乱,也降低了获取难度。Among them, in the embodiment of the present invention, the added single code is set in the blank area of the client to make full use of the blank area of the client, and the added single code is clear and concise, and the mapping relationship of the added is also easy to obtain, avoiding conflicts with other existing The codes are confused in the same area, resulting in confusion caused by code superposition, and also reduces the difficulty of acquisition.
实际应用中,增加的表情字符串与unicode间的第二映射关系可以通过轻量级的数据交换格式(例如:json)保存在类目录(例如:assets目录)中,可以定义为如下格式的映射表:In practical applications, the second mapping relationship between the added emoticon string and unicode can be saved in the class directory (such as the assets directory) through a lightweight data exchange format (such as: json), and can be defined as a mapping in the following format surface:
{"unicode":"0xF001","imgCode":"[:smile]"}{"unicode":"0xF001","imgCode":"[:smile]"}
{"unicode":"0xF002","imgCode":"[:cry]"}{"unicode":"0xF002","imgCode":"[:cry]"}
当图片表情处理程序运行时将上述映射表加载至内存,供客户端查找、提取、处理等等。When the picture expression processing program is running, the above mapping table is loaded into the memory for the client to search, extract, process and so on.
步骤S302增设了第二映射关系之后,本发明实施例执行步骤S304,结合第一映射关系和第二映射关系,以在图片表情和单一码间建立对应映射关系。After adding the second mapping relationship in step S302, the embodiment of the present invention executes step S304 to combine the first mapping relationship and the second mapping relationship to establish a corresponding mapping relationship between the picture expression and the single code.
具体地,图4示出了根据本发明一个实施例的图片表情、表情字符串及unicode的映射关系示意图。参见图4,第一映射关系和第二映射关系通过表情字符串实现两者的结合,使得图片表情与unicode建立对应的映射关系。以微笑表情为例,结合微笑图片表情与微笑表情字符串"[:smile]"的第一映射关系及"[:smile]"与单一码"0xF001"第二映射关系,在微笑图片表情与单一码"0xF001"建立对应的映射关系。Specifically, FIG. 4 shows a schematic diagram of the mapping relationship between picture emoticons, emoticon character strings and unicode according to an embodiment of the present invention. Referring to FIG. 4 , the combination of the first mapping relationship and the second mapping relationship is realized through the emoticon character string, so that a corresponding mapping relationship is established between the picture emoticon and unicode. Taking the smile expression as an example, combining the first mapping relationship between the smile picture expression and the smile expression string "[:smile]" and the second mapping relationship between "[:smile]" and the single code "0xF001", the smile picture expression and the single The code "0xF001" establishes the corresponding mapping relationship.
综上可知,本发明实施例提供了一种表情字符串的处理方法及装置,由于图片表情与表情字符串的第一映射关系在用于识别图片表情时存在一定的漏洞,导致图片表情与表情字符串可能会被视为两个单独的个体存在,此时,若需要对表情进行处理,可能需要得执行多次才能完成处理,为解决这一技术问题,本发明增加了表情字符串与unicode的第二映射关系,unicode是一种在计算机上使用的国际标准编码,能够用统一并且唯一的二进制编码表示世界上所有的书写语言中可能用于电脑通讯的字元、象形文字和其他符号,即,unicode具备唯一性。正是因为unicode具备唯一性,使得图片表情、表情字符串与unicode三者间建立的映射关系也具有唯一性,此时若对图片表情进行处理,通过具备唯一性的映射关系中的任意一个元素可以查找到其他两个元素,从而使得图片表情的操作也具备唯一性,对任意一个元素进行操作时,均能够根据图片表情、表情字符串与unicode三者间建立的具备唯一性的映射关系,将涉及到的其他两个元素进行处理,因此能够保证一次完成图片表情处理,从而避免了一个表情处理需要多次操作所导致的时间缓慢、资源浪费、用户感受体验较差等问题。In summary, the embodiments of the present invention provide a method and device for processing expression strings. Since the first mapping relationship between picture expressions and expression strings has certain loopholes when used to identify picture expressions, the difference between picture expressions and expression strings The character string may be regarded as two separate individuals. At this time, if the expression needs to be processed, it may need to be executed many times to complete the processing. To solve this technical problem, the present invention adds expression string and unicode The second mapping relationship, unicode is an international standard encoding used on computers, which can use a unified and unique binary code to represent characters, pictographs and other symbols that may be used for computer communication in all written languages in the world, That is, unicode is unique. It is precisely because of the uniqueness of unicode that the mapping relationship established between the picture expression, the expression string and unicode is also unique. At this time, if the picture expression is processed, any element in the unique mapping relationship The other two elements can be found, so that the operation of the picture expression is also unique. When operating any element, it can be based on the unique mapping relationship established between the picture expression, expression string and unicode. The other two elements involved are processed, so the image expression processing can be completed at one time, thereby avoiding problems such as slow time, waste of resources, and poor user experience caused by multiple operations for one expression processing.
在图片表情与单一码之间建立起对应的映射关系(即步骤S304)之后,若接收到某个图片表情的处理消息,则可以根据增设的unicode对图片表情进行处理。具体地,图5示出了根据本发明一个实施例的图片表情的处理方式的处理流程图。参见图5,该方法至少包括步骤S502至步骤S504。After the corresponding mapping relationship between the picture expression and the single code is established (ie step S304), if a processing message of a certain picture expression is received, the picture expression can be processed according to the added unicode. Specifically, FIG. 5 shows a processing flow chart of a processing manner of image emoticons according to an embodiment of the present invention. Referring to Fig. 5, the method at least includes steps S502 to S504.
步骤S502、接收到某个图片表情的处理消息时,利用该图片表情和单一码间建立的对应映射关系,查找到与该图片表情对应的单一码;Step S502, when receiving a processing message of a picture expression, use the corresponding mapping relationship established between the picture expression and the single code to find the single code corresponding to the picture expression;
步骤S504、对查找到的单一码执行步骤S502的处理消息中携带的处理操作。Step S504, execute the processing operation carried in the processing message of step S502 on the found unique code.
在本发明实施例中,如前文所述,因单一码具备唯一性,使得三者间的映射关系也具备唯一性,使得对图片表情的操作也具备唯一性,单一码执行完成处理操作后,使得操作界面上的图片表情在后台程序中有一个唯一的字符表示,再对该图片表情进行处理时,后台对单一码对应的图片表情及表情字符串均进行处理,从而避免了因一个表情处理需多次操作所导致的时间缓慢、资源浪费、用户感受体验较差等问题。In the embodiment of the present invention, as mentioned above, due to the uniqueness of the single code, the mapping relationship between the three is also unique, so that the operation on the picture expression is also unique. After the single code is executed and the processing operation is completed, Make the picture expression on the operation interface have a unique character representation in the background program, and then when the picture expression is processed, the background will process the picture expression and the expression string corresponding to the single code, thereby avoiding the need for one expression processing Problems such as slow time, waste of resources, and poor user experience caused by multiple operations.
本发明实施例中,上述步骤的实施主体可能是即时通信客户端,例如QQ、易信、微信、短信、彩信等能够使用文字、图片等文本格式进行沟通的客户端。In the embodiment of the present invention, the implementation subject of the above steps may be an instant messaging client, such as QQ, Yixin, WeChat, SMS, MMS, etc., which can use text formats such as text and pictures to communicate.
进一步,在本发明的一个优选实施例中,步骤S502所提及的查找到与图片表情对应的单一码具体可以包括如下步骤:Further, in a preferred embodiment of the present invention, the finding of the single code corresponding to the picture emoticon mentioned in step S502 may specifically include the following steps:
步骤1、根据图片表情与表情字符串的第一映射关系,查找到该图片表情对应的表情字符串;Step 1, according to the first mapping relationship between the picture expression and the expression string, find the expression string corresponding to the picture expression;
步骤2、根据表情字符串与unicode的第二映射关系,根据步骤1中查找到的表情字符串,进一步查找到与该表情字符串对应的单一码。Step 2. According to the second mapping relationship between the emoticon character string and unicode, according to the emoticon character string found in step 1, further find the unicode corresponding to the emoticon character string.
具体地,以微笑表情为例,输入微笑图片表情时,程序运行时通过建立的第一映射关系,查找到微笑图片表情对应的表情字符串"[:smile]",通过增加建立的第二映射关系,查找到该表情字符串对应的单一码"0xF001"。Specifically, taking a smiley expression as an example, when inputting a smiley picture expression, the first mapping relationship established when the program is running, finds the expression string "[:smile]" corresponding to the smiling picture expression, and adds the established second mapping relationship, find out the unique code "0xF001" corresponding to the emoticon string.
在本发明的一个优选实施例中,步骤S504所提及对查找到的单一码执行处理消息中携带的处理操作,可以包括如下步骤:In a preferred embodiment of the present invention, as mentioned in step S504, performing the processing operation carried in the processing message on the found single code may include the following steps:
步骤1、调用与处理消息对应的处理函数;Step 1. Call the processing function corresponding to the processing message;
步骤2、利用处理函数设置单一码与图片表情位图间的转换关系;Step 2, utilizing the processing function to set the conversion relationship between the single code and the image emoticon bitmap;
步骤3、利用处理函数对单一码执行上述处理消息中携带的处理操作,并利用单一码与图片表情位图间的转换关系将处理操作映射到图片表情位图。Step 3: Use the processing function to execute the processing operation carried in the above processing message on the single code, and use the conversion relationship between the single code and the picture expression bitmap to map the processing operation to the picture expression bitmap.
本发明实施例中步骤2提及的利用处理函数设置单一码与图片表情位图间的转换关系,其中,图片表情位图是由Emoji表情库中所有图片表情解析而成,即首先需要将图片表情转化为Windows标准格式图形文件,进而对Windows标准格式图形文件进行解析,形成位图文件(bitmap),bitmap是使用像素阵列来表示图片表情,将图片表情定义为由点(例如像素)组成,每个点可以由多种色彩表示,包括2、4、8、16、24和32位色彩。将每个图片表情解析成对应的位图文件bitmap后,将对应的bitmap与其对应的文件名配对,并用列表(List)对配对结果进行保存,List中各项可以定义为如下格式,In the embodiment of the present invention, the processing function mentioned in step 2 is used to set the conversion relationship between the single code and the picture expression bitmap, wherein the picture expression bitmap is formed by analyzing all picture expressions in the Emoji expression library, that is, at first the picture needs to be The expression is converted into a Windows standard format graphics file, and then the Windows standard format graphics file is analyzed to form a bitmap file (bitmap). The bitmap uses a pixel array to represent the picture expression, and the picture expression is defined as being composed of points (such as pixels). Each point can be represented by a variety of colors, including 2, 4, 8, 16, 24, and 32-bit colors. After parsing each picture expression into a corresponding bitmap file bitmap, pair the corresponding bitmap with its corresponding file name, and save the pairing result with a list (List). The items in the List can be defined as the following format,
以微笑表情为例,Take the smiley emoji as an example,
数据库中的各图片表情被解析成对应的bitmap并进行保存,相应地,当进行图片表情处理时,可以调用相应的bitmap并显示在客户端界面。Each image expression in the database is parsed into a corresponding bitmap and stored. Correspondingly, when the image expression is processed, the corresponding bitmap can be called and displayed on the client interface.
具体地,以微笑表情输入为例,查找微笑图片表情对应的单一码后"0xF001",由于输入部分包括图片,程序运行时Textview控件中需要新建一个图文混排函数SpannableString,然后调用setSpan函数设置单一码"0xF001"与微笑图片表情对应的位图文件的转换关系,即将查找到的单一码"0xF001"转换为位图文件,最后将得到的SpannableString插入到编辑文本当前光标位置完成微笑图片表情的输入。Specifically, taking the smiley expression input as an example, after searching for the single code "0xF001" corresponding to the smiley picture expression, since the input part includes pictures, a new graphic-text mixing function SpannableString needs to be created in the Textview control when the program is running, and then call the setSpan function to set The conversion relationship between the single code "0xF001" and the bitmap file corresponding to the smiling picture emoticon is to convert the found single code "0xF001" into a bitmap file, and finally insert the obtained SpannableString into the current cursor position of the edit text to complete the smiley picture emoticon enter.
对于常用的即时通信类客户端,信息传输是双方的,任意一个信息(常见的是文本信息)由本地客户端生成,上传至服务器后,由服务器对该信息进行处理,进而将处理后的信息转发至对方客户端。由此可见,信息生成之后,服务器端与对方客户端均需要能够识别出相应信息。而本发明实施例中,对图片表情增设了第二映射关系,如果直接将包含增设了第二映射关系的图片表情发送出去,则服务器、对方客户端均可能对此无法识别。For commonly used instant messaging clients, information transmission is two-way. Any information (commonly text information) is generated by the local client, and after uploading to the server, the server processes the information, and then the processed information Forward to the other client. It can be seen that, after the information is generated, both the server and the counterpart client need to be able to identify the corresponding information. However, in the embodiment of the present invention, the second mapping relationship is added to the picture expression. If the picture expression including the second mapping relationship is directly sent out, neither the server nor the other client may be able to recognize it.
因此,以文本内容为例,为了保障服务器能够识别文本内容,并能够将文本内容完整地转发至对方客户端,需要对文本内容进行处理。图6示出了根据本发明一个实施例的包括至少一个图片表情的文本输入结束后,将该文本上传至服务器的处理流程图。参见图6,该文本上传的流程至少包括步骤S602至步骤S608。Therefore, taking the text content as an example, in order to ensure that the server can recognize the text content and completely forward the text content to the counterpart client, the text content needs to be processed. Fig. 6 shows a flow chart of uploading the text to the server after the text including at least one emoticon is input according to an embodiment of the present invention. Referring to FIG. 6 , the text upload process includes at least step S602 to step S608 .
步骤S602、获取文本的文本内容;Step S602, acquiring the text content of the text;
步骤S604、解析出其中的单一码,利用表情库中存储的单一码与表情字符串的逆向映射关系查找到对应的表情字符串;Step S604, parsing out the single code, using the reverse mapping relationship between the single code and the expression string stored in the expression library to find the corresponding expression string;
步骤S606、使用查找出的对应的表情字符串替换单一码在上述文本中的位置;Step S606, using the found corresponding emoticon character string to replace the position of the single code in the above text;
步骤S608、将替换结束得到的文本上传至服务器。Step S608, uploading the text obtained after the replacement to the server.
本发明实施例中步骤S604利用表情字符串与unicode的逆向映射关系,查找到unicode对应的表情字符串,图7示出了根据本发明一个实施例的图片表情、表情字符串及unicode的结合逆向映射关系示意图。在实际应用中,图片表情、表情字符串及unicode的映射关系均是可逆的,例如某些智能机内核能够识别的是表情字符串,在实际处理中就可以使用表情字符串与图片表情的逆向映射关系查找到图片表情,进而显示图片表情。同理,也可能存在某些终端,其后台仅能够识别unicode,进而可以根据unicode与图片表情间的间接逆向映射关系查找到对应的图片表情,并显示在终端界面。In the embodiment of the present invention, step S604 utilizes the reverse mapping relationship between emoticon character strings and unicode to find the emoticon character string corresponding to unicode. FIG. Schematic diagram of the mapping relationship. In practical applications, the mapping relationship between picture emoticons, emoticon strings and unicode is reversible. For example, some smart machine kernels can recognize emoticon strings. In actual processing, the reverse of emoticon strings and picture emoticons can be used. The mapping relationship finds the picture expression, and then displays the picture expression. Similarly, there may be some terminals whose background can only recognize unicode, and then can find the corresponding picture expression according to the indirect reverse mapping relationship between unicode and picture expression, and display it on the terminal interface.
具体地,以包括微笑表情的文本内容为例,客户端将该文本内容上传至服务器时需要对其进行如下处理,首先获取编辑文本(EditText)中的文本内容,解析出文本内容中的单一码"0xF001",通过单一码"0xF001"与对应的表情字符串的逆向映射关系找到微笑表情字符串"[:smile]",并将微笑表情字符串"[:smile]"替换掉单一码"0xF001",最后将替换后的文本上传至服务器。Specifically, taking the text content including smiling emoticons as an example, when the client uploads the text content to the server, it needs to perform the following processing. First, obtain the text content in the edit text (EditText), and parse out the single code in the text content "0xF001", find the smile expression string "[:smile]" through the reverse mapping relationship between the single code "0xF001" and the corresponding expression string, and replace the smile expression string "[:smile]" with the single code "0xF001 ", and finally upload the replaced text to the server.
图6所示的文本内容处理流程中,对使用了第二映射关系的文本内容进行处理,根据单一码与表情字符串的逆向映射规则查找对应的表情字符串,进而使用查找到的表情字符串替换单一码在文本中的位置,该修改使得文本信息恢复到未使用第二映射关系之前,可视为原始文本信息。随后,将恢复得到的原始文本信息上传至服务器,由服务器进行传输。图6所示的恢复操作的目的是能够有效地防止服务器端不识别增设的unicode,避免服务器在识别文本内容时出现文本内容乱码等问题,或者在传输文本至其他客户端时发生传送错误、丢包等问题。另一方面,图6所示的恢复操作在客户端侧执行,并不需要服务器参与,服务器不需要为增设的表情字符串与单一码的映射关系增加新的数据解析方式,无须作任何改动,因此,本发明实施例能够在不改变服务器等增加硬件成本的情况下,完成图片表情处理操作,节省了大量资源。综上,上述文本内容处理操作更加有利于服务器响应服务请求,保障服务的质量。In the text content processing flow shown in Figure 6, the text content using the second mapping relationship is processed, the corresponding emoticon string is searched according to the reverse mapping rules of the single code and the emoticon string, and then the found emoticon string is used The position of the single code in the text is replaced, and the modification makes the text information return to the original text information before the second mapping relationship is not used. Subsequently, the recovered original text information is uploaded to the server for transmission by the server. The purpose of the recovery operation shown in Figure 6 is to effectively prevent the server from not recognizing the added unicode, to avoid problems such as garbled text content when the server recognizes the text content, or to avoid transmission errors and lost data when transmitting text to other clients. package etc. On the other hand, the recovery operation shown in Figure 6 is performed on the client side without the participation of the server, and the server does not need to add a new data analysis method for the mapping relationship between the added emoticon character string and the single code, and does not need to make any changes. Therefore, the embodiment of the present invention can complete the image expression processing operation without changing the server and increasing the hardware cost, saving a lot of resources. To sum up, the above text content processing operation is more conducive to the server responding to the service request and ensuring the quality of the service.
另外,本发明提出的图片表情与表情字符串的第一次映射关系和表情字符串与unicode的第二次映射关系对服务器来说是透明的,服务器不需要做额外的兼容处理。In addition, the first mapping relationship between picture expressions and expression strings and the second mapping relationship between expression strings and unicode proposed by the present invention are transparent to the server, and the server does not need to do additional compatibility processing.
下面,以客户端将“今天老师给小明发了一朵小红花(此处为“小红花”图片表情)”的文本内容发送至对方客户端作为本发明一个具体实施例,进一步说明本发明的表情字符串的处理方法的流程及按照本发明生成的图片表情进行处理操作时的有益效果。Next, take the client as a specific embodiment of the present invention to further illustrate the present invention by sending the text content of "Today the teacher sent Xiao Ming a little red flower (here is the picture expression of "Little Red Flower")" to the other party's client. The process flow of the inventive processing method for emoticon character strings and the beneficial effect when the image emoticons generated according to the present invention are processed and operated.
需要输入的文本内容既包括“今天老师给小明发了一朵小红花”的文字内容,又包括“小红花”的图片内容。客户端编辑文本输入完“今天老师给小明发了一朵小红花”的文字部分后,需要输入小红花图片表情,此时,后台程序根据图片表情与表情字符串的第一映射关系,查找到小红花图片表情对应的表情字符串"[:red flower]",再根据增设的表情字符串与unicode的第二映射关系,查找到"[:red flower]"对应的单一码"0xF003"。之后单一码"0xF003"执行处理操作,首先编辑文本Textview控件中新建一个图文混排函数SpannableString,然后调用setSpan函数将单一码"0xF003"转换为小红花图片表情的位图文件,得到的SpannableString插入到编辑文本当前光标位置完成小红花图片表情的输入。客户端完成“今天老师给小明发了一朵小红花(此处为“小红花”图片表情)”的文本内容输入后,需要将该段文本内容上传至服务器,并由服务器转发至对方客户端。由于该文本内容中小红花图片表情是由增设的单一码"0xF003"执行处理操作完成输入的,为了保障服务器能够识别小红花图片表情,需要对其进行如下处理,获取“今天老师给小明发了一朵小红花(此处为“小红花”图片表情)”的文本内容,解析出该文本内容中小红花图片表情的单一码"0xF003",并根据单一码与表情字符串的逆向映射关系,查找到单一码"0xF003"对应的表情字符串"[:red flower]",并在后台将"[:red flower]"替换掉单一码"0xF003",即文本信息恢复到未使用第二映射关系之前,将恢复得到的文本信息上传至服务器,由服务器传送至对方客户端。The text content that needs to be input includes not only the text content of "Today the teacher sent Xiao Ming a little red flower", but also the picture content of "Little red flower". After the client edits the text and enters the text part of "Today the teacher sent Xiao Ming a little red flower", it needs to input the picture expression of the little red flower. At this time, the background program will, according to the first mapping relationship between the picture expression and the expression string, Find the expression string "[:red flower]" corresponding to the expression of the little red flower picture, and then find the single code "0xF003" corresponding to "[:red flower]" according to the second mapping relationship between the added expression string and unicode ". Afterwards, the single code "0xF003" performs processing operations. First, edit the text in the Textview control to create a new image-text mixing function SpannableString, and then call the setSpan function to convert the single code "0xF003" into a bitmap file of the little red flower picture expression, and the obtained SpannableString Insert it into the edit text at the current cursor position to complete the input of the little red flower picture emoticon. After the client completes the input of the text content of "Today the teacher sent Xiao Ming a little red flower (here is the picture expression of "Little Red Flower")", it needs to upload the text content to the server, and the server forwards it to the other party client. Since the emoticon of the little red flower in the text content is input through the processing operation of the added single code "0xF003", in order to ensure that the server can recognize the emoticon of the little red flower, it needs to be processed as follows to obtain "Today the teacher sent Xiaoming A little red flower (here is the "little red flower" picture emoticon)" text content, parse out the single code "0xF003" of the little red flower picture emoticon in the text content, and according to the reverse of the single code and the expression string Mapping relationship, find the emoticon string "[:red flower]" corresponding to the single code "0xF003", and replace the single code "0xF003" with "[:red flower]" in the background, that is, the text information is restored to the unused number Before the two mapping relationships, the recovered text information is uploaded to the server, and the server transmits it to the other client.
需要说明地是,文本内容中的“小红花”图片表情是由增设的单一码"0xF003"执行操作完成输入的,由于单一码"0xF003"具有唯一性,使得小红花图片表情、"[:redflower]"与单一码"0xF003"三者建立的映射关系也具有唯一性,若需要对“今天老师给小明发了一朵小红花(此处为“小红花”图片表情)”中的“小红花”图片表情进行删除或者复制等处理操作时,后台执行程序时,因默认"0xF003"的唯一性及三者建立的关系的唯一性,使对小红花图片表情的操作也具备唯一性,将涉及到的小红花图片表情、"[:red flower]"与单一码"0xF003"三个元素均进行处理,因此能够一次完成处理操作。It should be noted that the "Little Red Flower" picture emoticon in the text content is input through the operation of the added single code "0xF003". Due to the uniqueness of the single code "0xF003", the little red flower picture emoticon, "[ The mapping relationship established between :redflower]" and the single code "0xF003" is also unique. When the "Little Red Flower" picture emoticon is deleted or copied, when the program is executed in the background, due to the uniqueness of the default "0xF003" and the uniqueness of the relationship established between the three, the operation of the little red flower picture emoticon is also With uniqueness, the three elements involved in the expression of the little red flower picture, "[:red flower]" and the single code "0xF003" are all processed, so the processing operation can be completed at one time.
基于同一发明构思,本发明实施例还提供了一种表情字符串的处理装置。图8示出了根据本发明一个实施例的表情字符串的处理装置的结构示意图。参见图8,该装置至少包括:Based on the same inventive concept, an embodiment of the present invention also provides an emoticon character string processing device. Fig. 8 shows a schematic structural diagram of an apparatus for processing emoticon character strings according to an embodiment of the present invention. Referring to Figure 8, the device at least includes:
增加模块810,适于对于具备图片表情与表情字符串的第一映射关系的图片表情,在第一映射关系的基础上,增加表情字符串与单一码unicode的第二映射关系;The adding module 810 is suitable for adding the second mapping relationship between the expression string and the single code unicode on the basis of the first mapping relationship for the picture expression having the first mapping relationship between the picture expression and the expression string;
建立模块820,与增加模块810耦合,适于结合第一映射关系和第二映射关系,以在图片表情和单一码间建立对应映射关系。The establishment module 820, coupled with the addition module 810, is suitable for combining the first mapping relationship and the second mapping relationship to establish a corresponding mapping relationship between the picture expression and the single code.
在表情字符串处理装置中增加了表情字符串与unicode的第二映射关系后,本发明实施例可以进一步根据增设的映射关系对图片表情进行处理,图9示出了根据本发明一个实施例的表情字符串的处理装置的另一种结构示意图,该装置至少还包括:After adding the second mapping relationship between expression strings and unicode in the expression string processing device, the embodiment of the present invention can further process picture expressions according to the added mapping relationship. FIG. 9 shows the Another structural schematic diagram of an emoticon character string processing device, the device further includes at least:
查找模块830,与建立模块820耦合,适于接收到某个图片表情的处理消息时,利用图片表情和单一码间建立的对应映射关系,查找到与该图片表情对应的单一码;The search module 830, coupled with the establishment module 820, is suitable for receiving the processing message of a certain picture expression, utilizing the corresponding mapping relationship established between the picture expression and the single code to find the single code corresponding to the picture expression;
处理模块840,与查找模块830耦合,适于对查找到的单一码执行处理消息中携带的处理操作。The processing module 840, coupled with the search module 830, is adapted to perform the processing operation carried in the processing message on the found unicode.
在一个优选的实施例中,查找模块830还适于:In a preferred embodiment, the search module 830 is also adapted to:
根据第一映射关系,查找到该图片表情对应的表情字符串;According to the first mapping relationship, the expression string corresponding to the image expression is found;
进而,根据第二映射关系,查找到与该表情字符串对应的单一码。Furthermore, according to the second mapping relationship, the unique code corresponding to the emoticon character string is found.
在一个优选的实施例中,查找模块830还适于:In a preferred embodiment, the search module 830 is also adapted to:
调用与处理消息对应的处理函数;Call the processing function corresponding to the processing message;
利用处理函数设置单一码与图片表情位图间的转换关系;Use the processing function to set the conversion relationship between the single code and the image expression bitmap;
利用处理函数对单一码执行处理消息中携带的处理操作,并利用单一码与图片表情位图间的转换关系将处理操作映射到图片表情位图。The processing function is used to execute the processing operation carried in the processing message on the single code, and the processing operation is mapped to the picture expression bitmap by using the conversion relationship between the single code and the picture expression bitmap.
在一个优选的实施例中,参见图10,表情字符串的处理装置还可以包括:In a preferred embodiment, referring to FIG. 10, the emoticon character string processing device may also include:
上传模块850,与处理模块840耦合,适于在包括至少一个图片表情的文本输入结束后,按如下步骤将该文本上传至服务器:The upload module 850, coupled with the processing module 840, is suitable for uploading the text to the server according to the following steps after the text input including at least one picture emoticon is completed:
获取上述文本的文本内容;Get the text content of the above text;
解析出其中的单一码,利用表情库中存储的单一码与表情字符串的逆向映射关系查找到对应的表情字符串;Parsing out the single code, using the reverse mapping relationship between the single code stored in the expression library and the expression string to find the corresponding expression string;
使用查找出的对应的表情字符串替换单一码在所述文本中的位置;Replace the position of the single code in the text with the corresponding emoticon character string found;
将替换结束得到的文本上传至服务器。Upload the text obtained after the replacement to the server.
本发明实施例提供的任意一个优选实施例或其组合,可应用于多客户端间的消息传送过程,图11示出了根据本发明一个优选实施例的多客户端间消息传输的系统示意图。参见图11,该系统包括服务器1110,以及分别通过服务器1110进行消息传输的多客户端1120。图11的客户端的个数仅仅为示意值,在实际应用中可能成千上百甚至更多,本发明对此不做任何限定。Any one or combination of the preferred embodiments provided by the embodiments of the present invention can be applied to the process of message transmission between multiple clients. FIG. 11 shows a schematic diagram of a system for message transmission between multiple clients according to a preferred embodiment of the present invention. Referring to FIG. 11 , the system includes a server 1110 and multiple clients 1120 that transmit messages through the server 1110 respectively. The number of clients shown in FIG. 11 is only an illustrative value, and may be thousands or hundreds or even more in actual applications, which is not limited by the present invention.
综上,采用本发明实施例提供的表情字符串的处理方法及装置可以达到如下有益效果:To sum up, the method and device for processing emoticon strings provided by the embodiments of the present invention can achieve the following beneficial effects:
本发明实施例提供了一种表情字符串的处理方法及装置,由于图片表情与表情字符串的第一映射关系在用于识别图片表情时存在一定的漏洞,导致图片表情与表情字符串可能会被视为两个单独的个体存在,此时,若需要对表情进行处理,可能需要得执行多次才能完成处理,为解决这一技术问题,本发明增加了表情字符串与unicode的第二映射关系,unicode是一种在计算机上使用的国际标准编码,能够用统一并且唯一的二进制编码表示世界上所有的书写语言中可能用于电脑通讯的字元、象形文字和其他符号,即,unicode具备唯一性。正是因为unicode具备唯一性,使得图片表情、表情字符串与unicode三者间建立的映射关系也具有唯一性,此时若对图片表情进行处理,通过具备唯一性的映射关系中的任意一个元素可以查找到其他两个元素,从而使得图片表情的操作也具备唯一性,对任意一个元素进行操作时,均能够根据图片表情、表情字符串与unicode三者间建立的具备唯一性的映射关系,将涉及到的其他两个元素进行处理,因此能够保证一次完成图片表情处理,从而避免了一个表情处理需要多次操作所导致的时间缓慢、资源浪费、用户感受体验较差等问题。Embodiments of the present invention provide a method and device for processing expression strings. Since the first mapping relationship between image expressions and expression strings has certain loopholes when used to identify image expressions, the image expressions and expression strings may be It is regarded as two separate individuals. At this time, if the expression needs to be processed, it may need to be executed multiple times to complete the processing. To solve this technical problem, the present invention adds a second mapping between expression strings and unicode Relationship, unicode is an international standard encoding used on computers, which can represent characters, pictographs and other symbols that may be used for computer communication in all written languages in the world with a unified and unique binary encoding, that is, unicode has uniqueness. It is precisely because of the uniqueness of unicode that the mapping relationship established between the picture expression, the expression string and unicode is also unique. At this time, if the picture expression is processed, any element in the unique mapping relationship The other two elements can be found, so that the operation of the picture expression is also unique. When operating any element, it can be based on the unique mapping relationship established between the picture expression, expression string and unicode. The other two elements involved are processed, so the image expression processing can be completed at one time, thereby avoiding problems such as slow time, waste of resources, and poor user experience caused by multiple operations for one expression processing.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的表情字符串处理装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the emoticon character string processing apparatus according to the embodiment of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
至此,本领域技术人员应认识到,虽然本文已详尽示出和描述了本发明的多个示例性实施例,但是,在不脱离本发明精神和范围的情况下,仍可根据本发明公开的内容直接确定或推导出符合本发明原理的许多其他变型或修改。因此,本发明的范围应被理解和认定为覆盖了所有这些其他变型或修改。So far, those skilled in the art should appreciate that, although a number of exemplary embodiments of the present invention have been shown and described in detail herein, without departing from the spirit and scope of the present invention, the disclosed embodiments of the present invention can still be used. Many other variations or modifications consistent with the principles of the invention are directly identified or derived from the content. Accordingly, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.
Claims (6)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510642793.1A CN105160033B (en) | 2015-09-30 | 2015-09-30 | The processing method and processing device of expression character string |
| PCT/CN2016/096919 WO2017054597A1 (en) | 2015-09-30 | 2016-08-26 | Processing method and device for emoji string |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510642793.1A CN105160033B (en) | 2015-09-30 | 2015-09-30 | The processing method and processing device of expression character string |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN105160033A CN105160033A (en) | 2015-12-16 |
| CN105160033B true CN105160033B (en) | 2018-09-11 |
Family
ID=54800889
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510642793.1A Active CN105160033B (en) | 2015-09-30 | 2015-09-30 | The processing method and processing device of expression character string |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN105160033B (en) |
| WO (1) | WO2017054597A1 (en) |
Families Citing this family (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105160033B (en) * | 2015-09-30 | 2018-09-11 | 北京奇虎科技有限公司 | The processing method and processing device of expression character string |
| CN105718534B (en) * | 2016-01-14 | 2017-05-03 | 广州市动景计算机科技有限公司 | Information pushing apparatus, information pushing method and client |
| CN106055416B (en) * | 2016-05-23 | 2020-08-18 | 珠海市魅族科技有限公司 | Method and device for data cross-application transfer |
| CN106951105A (en) * | 2017-03-03 | 2017-07-14 | 深圳市联谛信息无障碍有限责任公司 | A kind of method that use Barrier-free Service reads emoticon |
| CN107360898A (en) * | 2017-07-05 | 2017-11-21 | 佛山杰致信息科技有限公司 | Greenhouse remote management system |
| US10650095B2 (en) | 2017-07-31 | 2020-05-12 | Ebay Inc. | Emoji understanding in online experiences |
| CN108805960A (en) * | 2018-05-31 | 2018-11-13 | 北京字节跳动网络技术有限公司 | Composing Method of Mixing, device, computer readable storage medium and terminal |
| CN111200552B (en) * | 2018-11-16 | 2022-05-13 | 腾讯科技(深圳)有限公司 | Instant communication method and device, equipment and storage medium thereof |
| CN110780955B (en) * | 2019-09-05 | 2023-08-22 | 连尚(新昌)网络科技有限公司 | Method and equipment for processing expression message |
| CN112965614B (en) * | 2019-12-12 | 2025-05-09 | 北京搜狗科技发展有限公司 | Expression processing method and device in input method application |
| CN111369645B (en) * | 2020-02-28 | 2023-12-05 | 北京百度网讯科技有限公司 | Methods, devices, equipment and media for displaying facial expression information |
| CN112036247A (en) * | 2020-08-03 | 2020-12-04 | 北京小米松果电子有限公司 | Expression package text generation method, device and storage medium |
| EP4530839A4 (en) * | 2022-09-02 | 2025-08-06 | Huawei Tech Co Ltd | DISPLAY METHOD AND ELECTRONIC DEVICE |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1749936A (en) * | 2004-09-07 | 2006-03-22 | 捷讯研究有限公司 | System and method for inserting a graphic object into a text based message |
| CN101281430A (en) * | 2007-04-06 | 2008-10-08 | 北京三星通信技术研究有限公司 | Device with emoticon associative input function and associative input method thereof |
| CN104331245A (en) * | 2014-11-03 | 2015-02-04 | 荀亮 | Click input method and Chinese character input method based on touch screens |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR100631611B1 (en) * | 2004-11-27 | 2006-10-09 | 엘지전자 주식회사 | Method of generating a user emoticon of a mobile communication terminal and a method of transmitting and receiving a short message using the same |
| CN101639755B (en) * | 2009-09-10 | 2011-07-13 | 腾讯科技(深圳)有限公司 | Method for supporting picture input and equipment thereof |
| CN103809766A (en) * | 2012-11-06 | 2014-05-21 | 夏普株式会社 | Method and electronic device for converting characters into emotion icons |
| CN104881146A (en) * | 2015-04-28 | 2015-09-02 | 北京美秒科技有限公司 | Picture input method |
| CN105279247A (en) * | 2015-09-30 | 2016-01-27 | 北京奇虎科技有限公司 | Expression library generation method and device |
| CN105160033B (en) * | 2015-09-30 | 2018-09-11 | 北京奇虎科技有限公司 | The processing method and processing device of expression character string |
-
2015
- 2015-09-30 CN CN201510642793.1A patent/CN105160033B/en active Active
-
2016
- 2016-08-26 WO PCT/CN2016/096919 patent/WO2017054597A1/en not_active Ceased
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1749936A (en) * | 2004-09-07 | 2006-03-22 | 捷讯研究有限公司 | System and method for inserting a graphic object into a text based message |
| CN101281430A (en) * | 2007-04-06 | 2008-10-08 | 北京三星通信技术研究有限公司 | Device with emoticon associative input function and associative input method thereof |
| CN104331245A (en) * | 2014-11-03 | 2015-02-04 | 荀亮 | Click input method and Chinese character input method based on touch screens |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2017054597A1 (en) | 2017-04-06 |
| CN105160033A (en) | 2015-12-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105160033B (en) | The processing method and processing device of expression character string | |
| US20120190388A1 (en) | Methods and apparatus for modifying a multimedia object within an instant messaging session at a mobile communication device | |
| US9971740B2 (en) | Dynamic webpage image | |
| CN109710370B (en) | Session list display method and device and electronic equipment | |
| JP7448672B2 (en) | Information processing methods, systems, devices, electronic devices and storage media | |
| US20210266276A1 (en) | Name label display method and apparatus | |
| CN104281601B (en) | Build method and device, character display method and the device of super large character library | |
| CN111158924B (en) | Content sharing method and device, electronic equipment and readable storage medium | |
| CN111352912A (en) | Compressed file processing method, device, storage medium, terminal and server | |
| US8718374B2 (en) | Method and apparatus for accessing an electronic resource based upon a hand-drawn indicator | |
| CN104410768B (en) | Information transferring method and device | |
| WO2013110290A1 (en) | Pattern matching engine | |
| CN111625308A (en) | Information display method and device and electronic equipment | |
| CN108089803A (en) | Screen capture information acquisition method and device | |
| CN112328927A (en) | Document processing method and device, readable medium and electronic equipment | |
| CN106888498A (en) | A kind of inter-terminal data transmission method, device and mobile terminal | |
| CN112651475A (en) | Two-dimensional code display method, device, equipment and medium | |
| CN110109594B (en) | Drawing data sharing method and device, storage medium and equipment | |
| CN108600829A (en) | Method for connecting same-screen device based on two-dimensional code | |
| JP2022091686A (en) | Data annotation methods, devices, electronic devices and storage media | |
| CN105893735B (en) | Medical information remote co-screen assistance method and terminal | |
| CN111523292B (en) | Method and device for acquiring image information | |
| CN104239067A (en) | Making method and device of miniature client end | |
| CN104572816B (en) | Information processing method and electronic equipment | |
| CN105279247A (en) | Expression library generation method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20220708 Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015 Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park) Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd. Patentee before: Qizhi software (Beijing) Co., Ltd |