[go: nahoru, domu]

CN107370731B - Method and device for realizing communication between different applications based on natural language - Google Patents

Method and device for realizing communication between different applications based on natural language Download PDF

Info

Publication number
CN107370731B
CN107370731B CN201710575070.3A CN201710575070A CN107370731B CN 107370731 B CN107370731 B CN 107370731B CN 201710575070 A CN201710575070 A CN 201710575070A CN 107370731 B CN107370731 B CN 107370731B
Authority
CN
China
Prior art keywords
application
protocol
natural language
message
information
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
Application number
CN201710575070.3A
Other languages
Chinese (zh)
Other versions
CN107370731A (en
Inventor
黄伟才
温丽芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Moqiu Technology Co ltd
Original Assignee
Beijing Moqiu Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Moqiu Technology Co ltd filed Critical Beijing Moqiu Technology Co ltd
Priority to CN201710575070.3A priority Critical patent/CN107370731B/en
Publication of CN107370731A publication Critical patent/CN107370731A/en
Application granted granted Critical
Publication of CN107370731B publication Critical patent/CN107370731B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

In the embodiment of the invention, a method for realizing communication among different applications based on natural language is provided: the second application receives a request message sent by the first application, wherein the request message is used for requesting target information related to a communication protocol which can be supported by the second application; sending a response message to the first application, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application; wherein the request message and/or the response message are sent based on natural language. In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information can be acquired by using the natural language, so that the communication with the second application is realized, the defect that the protocol which does not store the related application in advance in the prior art cannot be communicated with the application is overcome, and the range of an application scene is expanded.

Description

Method and device for realizing communication between different applications based on natural language
Technical Field
The invention relates to the technical field of communication, in particular to a method and a device for realizing communication among different applications based on natural language.
Background
With the development of technology, the variety of applications is increasing, and in many cases, a problem of data transmission between different applications is encountered. The data transmission method between the current common applications mainly includes the following steps:
one is as follows: the data transmission interfaces are respectively established with two different applications through a virtual container, then the data in the first application are transmitted into the virtual container through the corresponding first data transmission interface, and the data are transmitted into the second application through the virtual container and the second data transmission interface corresponding to the second application. Although the scheme can realize data transmission between two different applications, the scheme needs to pre-establish a data transmission interface of the virtual container, and if the data transmission interface is not pre-established or the interface between the application and the virtual container is not known, the data transmission between the two different applications cannot be realized;
the other is as follows: before two different applications communicate, a first application initiates a handshake comprising a unique identifier of the first application (the primary application) and a first random number for marking and/or certifying response requests, which unique identifier can be checked by the second application with a list of certified first applications to authenticate the first application. If verified, the second application responds with the first random number and a second random number, wherein the second random number may mark and/or certify the data request sent by the first application. However, in this scheme, if two different applications do not know the relevant information of the interactive process in advance, data transmission between the two applications is also impossible;
the other one is as follows: when data transmission is required between two different applications, the data transmission format of the first application is converted into the data transmission format of the second application, so that the data transmission between the two different applications is realized.
In summary, the existing communication transmission method between different applications can only be implemented on the basis of acquiring some related information in advance, otherwise, communication between different applications cannot be implemented.
Disclosure of Invention
In view of the above problems, the present invention is proposed to provide a method and an apparatus for communication between different applications, which overcome the above problems or at least partially solve the above problems, so as to solve the defect in the prior art that if some relevant information is not obtained in advance, communication between different applications cannot be achieved.
According to a first aspect of the present invention, there is provided a method for implementing communication between different applications based on natural language, including:
the method comprises the steps that a second application receives a request message sent by a first application, wherein the request message is used for requesting target information related to communication protocols which can be supported by the second application;
sending a response message to the first application, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application;
wherein the request message and/or the response message is transmitted based on a natural language.
In one embodiment, according to the method of the above embodiment of the present invention, the first application and the second application are both located on a first device; or
The first application is located on a first device and the second application is located on a second device.
In some embodiments, according to the method described in any one of the above embodiments of the present invention, the request message carries an indication protocol identifier;
the second application sends a response message to the first application, including:
and the second application returns a response message to the first application according to the indication protocol identification.
In some embodiments, according to the method of any one of the above embodiments of the present invention, the target information includes a protocol identification and/or a protocol definition.
In some embodiments, according to the method of any one of the above embodiments of the present invention, the protocol definition information includes at least one of message transmission interface definition information, format information of a message, and signaling flow information.
In some embodiments, according to the method of any one of the above embodiments of the present invention, the format information of the message includes a digital encoding format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application.
In some embodiments, according to the method of any of the above embodiments of the present invention, the protocol identification can be characterized by characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
In some embodiments, according to the method of any one of the above embodiments of the present invention, after the second application sends a response message to the first application, the method further includes:
if the at least one protocol supported by the second application does not match the at least one protocol supported by the first application, the second application continues to send response messages to the first application.
In some embodiments, according to the method of any of the above embodiments of the present invention, the natural language is speech and/or text.
According to a second aspect of the present invention, there is provided an apparatus for implementing communication between different applications based on natural language, comprising:
a receiving unit in the second application, configured to receive a request message sent by the first application, where the request message is used to request target information related to a communication protocol that can be supported by the second application;
a sending unit in the second application, configured to send a response message to the first application, where the response message carries target information related to at least one communication protocol that the second application can support;
wherein the request message and/or the response message is transmitted based on a natural language.
In one embodiment, according to the apparatus of the above embodiment of the present invention, the first application and the second application are both located on a first device; or
The first application is located on a first device and the second application is located on a second device.
In some embodiments, according to the apparatus of any one of the foregoing embodiments of the present invention, the request message carries an indication protocol identifier;
the sending unit in the second application sends a response message to the first application, including:
and the sending unit in the second application returns a response message to the first application according to the indication protocol identifier.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the target information includes a protocol identifier and/or a protocol definition.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the protocol definition information includes at least one of message transmission interface definition information, format information of a message, and signaling flow information.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the format information of the message includes a digital encoding format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the protocol identifier can be characterized by characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the sending unit in the second application continues to send the response message to the first application when the at least one protocol supported by the second application does not match the at least one protocol supported by the first application.
In some embodiments, according to the apparatus of any one of the above embodiments of the present invention, the natural language is speech and/or text.
According to a third aspect of the present invention, there is also provided an electronic apparatus comprising:
a memory and one or more processors;
wherein the memory is communicatively coupled to the one or more processors and has stored therein instructions executable by the one or more processors to cause the one or more processors to implement the method as described above.
In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information related to the communication protocol supported by the second application can be acquired by using the natural language, and the acquired target information can be used for communicating with the second application subsequently, so that the defect that the communication with the application cannot be performed without storing the protocol of the related application in advance in the prior art can be overcome, and the range of application scenes is expanded.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
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 embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow diagram for implementing communication between different applications based on natural language according to an embodiment of the present invention;
FIG. 2A is another flow diagram for enabling communication between different applications based on natural language, according to an embodiment of the present invention;
FIG. 2B is another flow diagram for enabling communication between different applications based on natural language, according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an apparatus for enabling communication between different applications based on natural language according to an embodiment of the present invention;
fig. 4 is another schematic diagram of an apparatus for implementing communication between different applications based on natural language according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While 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 to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The following is a brief description of technical terms that may be involved in the present application.
The communication Protocol is a Protocol different from a natural language form for communication, and includes a message format (including a message coding format, such as 00001-indicating that a television is turned off) defined by both communication parties, a signaling flow, and a message channel definition (such as a TCP (Transmission Control Protocol) port number), but these contents are preset. Particularly, the communication protocol may further include format definition of messages exchanged between applications, a flow of message exchange between applications, and a data format and an exchange flow of the messages at a physical layer and a transport layer.
The interface information is sometimes equivalent to the communication protocol and may be used alternatively, but the two are also different, for example, the interface information may also include a hardware electrical interface, which is a non-negotiable part, and the communication protocol is more negotiable, and therefore, the hardware electrical interface information is not generally included in the communication protocol. The interface information includes interface type, interface definition, interface specification, and the like.
Interface types (ethernet interfaces, USB (Universal Serial Bus) interfaces, etc.) typically include hardware electrical interface definitions, as well as message definitions, signaling flows, device behaviors, etc. based on the hardware interface. For the predetermined interface, it is generally supported by a corresponding communication protocol, such as an ethernet interface, and there is a corresponding ethernet protocol.
Definition of the interface: including hardware interfaces and protocol interfaces including the above-described message definitions, signaling flows, device behaviors, etc. The message definition may include a digitally encoded format of the message.
Interface specification (also called protocol specification): including message definitions, signaling flows, device behavior, etc., may be presented in any form, including natural language forms, tables, charts, etc.
The signaling flow refers to the order of messages (procedure) exchanged by both parties.
The digital coding format refers to a mode for digitally representing information, and belongs to the content which can be agreed in the protocol. For example, a "turn-on control command" of a tv can be represented by a 4-bit binary, such as b0001, and the 4-bit binary data b0001 is called a digital coding format, including compression, by encoding it by using a certain source coding or channel coding.
The following briefly describes communication between applications involved in embodiments of the present invention.
Communication between applications of the Android mobile phone:
using handler to deliver messages
One can think of a handle as a sub-thread of a main thread (UI thread), and it can send data to the main thread (UI thread) to update the UI and logic of the main thread (UI thread), and the handle is a sub-thread so that its time-consuming operation does not block the main thread, and it is known that in the development of Android, if a certain place in the code blocks the main thread for more than 5 seconds, the system prompts ANR (system prompts force to turn off), so we can consider to turn on a sub-thread to avoid ANR in time-consuming operation. The handler will send a message to the main thread, arrange in a queue to coordinate waiting for the main thread to update the UI logic, and so on.
For example, a message is passed by the handle to update the UI display content of the main thread, and after clicking a button, a message is sent by the handle every second to update the time displayed by the UI thread until the display time is updated to 10, and then the thread is ended.
The communication between the client and the server in the practical application will be briefly described below.
Each application in the server has a User data Protocol (UPD) port number or a Transmission Control Protocol (TCP) port number, an IP address of the server is generally fixed and unchangeable, and the client can know the IP address and the UPD/TCP port number in advance. Such as the WeChat Server side, an IP address, such as 20.22.119.10, is assigned to the WeChat application, with TCP port number 10000. The client sends the message to be sent to the server to a TCP port 10000 of the server with an IP address of 20.22.119.10 according to the format of a TCP message, and an application in the server continuously listens to the data sent to the port and sends the data to the wechat application. In this way, an initial communication between the client and the WeChat Server is established.
Fig. 1 schematically illustrates a method 10 for implementing communication between different applications based on natural language according to an embodiment of the present invention, including:
step 100: the first application acquires target information related to at least one communication protocol which can be supported by the second application based on the natural language;
step 110: and the first application sends a message to the second application according to all or part of the target information.
The natural language referred to in the embodiments of the present invention actually refers to a natural language that is non-preset content for a receiving party, not a natural language form of fixed content. The natural language of the non-preset content means that a receiver needs to perform semantic analysis; and the receiver can directly match the character strings by presetting the natural language of the content. For example, in the case of a natural language that does not include preset contents, "today is good and hot", or "today is good and high in temperature", or "today is fast dying", although the contents are different, the meanings are substantially the same, and any expression may be used. For another example, in the case of a natural language other than the preset content, the "current temperature" and the "current temperature" have different expressions, but have the same semantic meaning, and may be expressed in any form.
In the embodiment of the present invention, there are various natural language expression modes, for example, the natural language expression mode may be a voice form, or may also be a text form (for example, Internet Protocol (IP) network broadcast), and both the voice form and the text form may adopt an ultrasonic mode. The text may be specifically a picture text or a text presented in a two-dimensional code form, the voice may be music, and of course, other forms are possible, which are not limited specifically herein.
Of course, the first application may also define the specification by the FTP download protocol.
In this embodiment of the present invention, optionally, the first application and the second application are both located in a first device; or
The first application is located on a first device and the second application is located on a second device.
In this embodiment of the present invention, optionally, the acquiring, by the first application, target information related to at least one communication protocol that the second application can support based on a natural language includes:
the first application sends a request message to a second application based on natural language, wherein the request message is used for requesting target information related to communication protocols which can be supported by the second application;
and the first application receives a response message returned by the second application, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application.
That is to say, a natural language is adopted when the first application sends the request message to the second application, but the form in which the second application returns the response message to the first application is not particularly limited, and may be a natural language form, or may also be a protocol specified by the first application, for example, the request message carries an indication protocol identifier;
at this time, optionally, the receiving, by the first application, a response message returned by the second application includes:
and the first application receives a response message returned by the second application according to the indication protocol identifier.
Of course, the second application may return the response message to the first application in other forms, and is not limited in this respect.
In the foregoing, it is described that the first application sends the message to the second application in the natural language, but the form in which the second application sends the message to the first application is not specifically limited.
Accordingly, the first application acquires target information related to at least one communication protocol that the second application can support based on the natural language, including:
the first application sends a request message to a second application, wherein the request message is used for requesting target information related to communication protocols which can be supported by the second application;
and the first application receives a response message returned by the second application based on natural language, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application.
In this embodiment of the present invention, the request message may be a message for directly requesting information related to a communication protocol, such as: the first application sends a message in natural language form to the second application asking for information related to the communication protocol, which then replies to the first application with the information related to the communication protocol.
Or the request message may also be a message for indirectly or implicitly requesting information related to the communication protocol, as long as the second application is triggered to return a message containing the target information to the first application, such as: the first application sends a username and password in natural language form to the second application (implicit way), which then replies to the first application with information related to the communication protocol (implicit response).
The foregoing describes a direct manner of requesting a message, or an implicit, indirect manner, and similarly, the response may be an explicit information request response directly to the first application, or an implicit, indirect response. And will not be described in detail herein.
In the embodiment of the invention, a broadcast sending and receiving mechanism can be used for realizing communication between two completely unrelated applications in the Android system, for example, an application A sends a broadcast, and an application B receives the broadcast and then executes related operations, so that mutual communication can be realized.
In this embodiment of the present invention, when the first application obtains the target information related to at least one communication protocol that the second application can support based on the natural language, optionally, the following manner may be adopted:
the first application acquires the target information sent by the second application based on a broadcast message.
Optionally, the broadcast message is a broadcast message between applications.
The following takes android as an example to briefly describe the broadcasting between different applications within the same device.
Android broadcasting is divided into two aspects: a broadcast sender and a broadcast receiver, generally broadcastrepeat, refer to a broadcast receiver (broadcast receiver). The broadcasting is used as a communication mode among Android components, and available scenes at least comprise the following scenes:
1. messaging within the same component (between single or multiple threads) within the same application;
2. message communication between different components within the same application (single process);
3. message communication between different components of the same application having multiple processes;
4. inter-component messaging between different applications;
messaging between the Android system and applications in certain situations.
From the implementation principle, broadcasting in Android uses an observer mode, based on a publish/subscribe event model of messages. The specific implementation flow points are roughly summarized as follows:
1. a broadcast receiver (broadcastrecherver) registers with ams (activitymanageservice) through a Binder mechanism;
2. a broadcast sender sends a broadcast message to the AMS through a Binder mechanism;
AMS searches for broadcast receivers meeting corresponding conditions (IntentFilter/Permission, etc.), and sends the broadcast messages to message circular queues corresponding to the searched broadcast receivers (Activity in general);
4. the message loop executes to get to this broadcast message, calling back the onReceive () method in the broadcast receiver.
The specific implementation may be slightly different for different types of broadcast messages and registration modes of different broadcast receivers, but the overall flow is roughly as above. From this point of view, the broadcast sender and the broadcast receiver belong to both ends of the message publish and subscribe in the watcher mode, respectively, and the AMS belongs to the processing center in the middle.
Between the applications across the devices, if it is not known on which device the destination application runs, the source application may transmit the relevant information in a network broadcast manner. For example, if the destination IP (Internet Protocol) address of the broadcast message is set to 255.255.255.255, other devices on the network can receive the broadcast message.
In the embodiment of the present invention, there are various ways for the first application to send the request message to the second application, and optionally, the following ways may be adopted:
the first application receives instruction information sent by a user;
the first application obtains a semantic analysis result of the instruction information;
and the first application determines a request message corresponding to the semantic analysis result and sends the request message to the second application.
When the first application obtains the semantic analysis result of the instruction information, the semantic analysis can be performed on the instruction information to obtain a semantic analysis result; of course, the semantic analysis result may also be returned to the first application after the semantic analysis is performed by the cloud device or the server, which is not specifically limited herein.
While the first application obtains the semantic analysis result of the instruction information, it is needless to say that the method for obtaining the semantic analysis result of other messages based on the natural language form is similar to the method for obtaining the semantic analysis result of the instruction information, and the detailed description thereof is omitted here.
Since the manner in which the first application sends the request message to the second application may be a natural language or may not be a natural language, the specific implementation manner may be applicable to a manner in which the first application sends the request message to the second application by using a natural language, or may be applicable to a manner in which the first application sends the request message to the second application by using another manner, and is not limited specifically herein.
The above-mentioned mode can be realized by adopting the following form:
the first application receives instruction information sent by a user and converts the instruction information into formatted data;
carrying out normalization processing on the formatted data to obtain a semantic analysis result of the instruction information;
and determining a request message corresponding to the semantic analysis result, and sending the request message to the second application.
In this embodiment of the present invention, the request message sent by the first application is based on a natural language, and the response message returned by the second application may also be based on a natural language, which is not limited herein.
For example, the first application and the second application are two independently developed social software, whose buddy lists are to be synchronized, but do not know each other's digital transmission format, at which point the first application can query the second application in natural language, such as "how do your buddy list data be digitally encoded? The second application receives the message in natural language form, and after semantic parsing, it passes its own digitally encoded form to the first application in natural language, e.g. "the list is transmitted in binary encoded format, for a total length of five bytes (40 bits), where the first byte represents the last name, the last three bytes represent the first name (if the first name is only one byte, then the last 16 bits are represented by the all zero sequence), and the last byte represents the gender. ", the second application may then send the binary sequence list corresponding to each byte in text form to the first application. After the first application receives the data, the semantic analysis is carried out to obtain the digital coding format of the second application, and the two parties can directly carry out high-efficiency data transmission in a uniform digital coding mode. For example, to transmit information of a boy student of zhang san in the first application to the second application, a string of binary sequences may be transmitted.
In this embodiment of the present invention, optionally, the target information includes a protocol identifier and/or protocol definition information, and certainly, may also include other information, which is not specifically limited herein.
In this embodiment of the present invention, optionally, the protocol definition information includes at least one of message transmission interface definition information, message format information, and signaling flow information, and certainly, may also include other information, which is not specifically limited herein. The data transmission interface includes a physical layer electrical characteristic definition (such as a transmission voltage size, a signal power size, a bus type, a clock frequency, and the like), a physical layer data reading timing (such as a data reading and writing timing, a duty cycle specification, and the like), a transport layer protocol (such as a channel coding, a transmission check mechanism, a retransmission mechanism, and the like), and a network layer transport protocol (such as an IP address, a UDP (User datagram protocol), or a TCP port number, and the like).
The signaling flow is described below by taking the signaling flow for obtaining the friend information as an example:
step 1: the first application sends a list _ req message;
when a friend list needs to be obtained, a first application sends a list _ req message;
step 2: the second application sends out the list _ data after receiving the list _ req message.
And if the second application does not receive the list _ data within the range of 1s, the first application resends the list _ req message.
The signaling procedure for obtaining the friend information is only described as an example, but the signaling procedure is not limited to this.
In this embodiment of the present invention, optionally, the format information of the message includes a digital coding format;
wherein the digital coding format includes at least one of a field (filed), a length (length), a range (range), and a data type (type) of the data that can be received by the second application. The format information of the message may further include a compression format.
The digital encoding format may be in the form of a table, such as the examples shown in tables 1, 2.
TABLE 1 digital coding Format
Field(s) Type (B) Length of Value range Supplementary information
Friend list data (list _ data) Character string type 40 bits of -40 to 60 Bearer in IP/UDP (port 10001) manner
TABLE 2 digital coding Format
Field(s) Type (B) Length of Value range Supplementary information
Buddy list request (list _ req) Shaping machine 1 bit 0,1 Bearer in IP/UDP (port 10001) manner
In the value range entries of table 2, 0 indicates that the buddy list data is no longer needed; a 1 indicates that buddy list data needs to be received.
Optionally, the table may be in a form of a picture, or may also be a document in a form of rich text, which is not limited herein.
In the embodiment of the present invention, optionally, the protocol identifier can be characterized by characterization information;
wherein the representation information includes at least one of an Identification ID (Identification) of the second application, a type of the second application, a version number of the second application (e.g., mi6), an internet protocol IP address related to the second application, and a related keyword (e.g., "DLNA").
At this time, the sending, by the first application, a message to the second application according to all or part of the target information includes:
the first application determines a protocol corresponding to the characterization information according to the characterization information;
and sending a message to the second application by adopting the determined protocol.
The ID of the second application is exemplified below:
for example, the application has one process or a plurality of IDs in the operating system, and for example, the Android applications all have a unique application ID.
The IP address related to the second application may refer to an IP address of a server where the second application runs, an IP address of a website where the second application runs, or an IP address of a computer where the second application runs, where the IP address may be a website address (e.g., www.mqpat.com) embodied in the form of a domain name.
In this embodiment of the present invention, optionally, the determining, by the first application, the protocol corresponding to the characterization information according to the characterization information includes:
the first application acquires corresponding protocol information through third equipment;
wherein the third device is at least one of an internet server, a search engine and a natural language interaction engine.
For example, the first application obtains its own device ID fed back by the server in a natural language manner, and the first application uses the ID as a keyword to download a protocol definition supported by the second application through an internet search engine. In general, the manner in which the protocol definition is obtained is not limited. Writing a code segment in the first application as a natural language generation module, when it is to communicate with the second application, the first application first generating and issuing information about a query about natural language (such as voice or text) of the interface definition and data transmission format of the second application; the information about the interface type/data transmission format may be a type, software and hardware version number, a manufacturer, etc. of the second application, or may be a direct query interface definition/specification, which is not specifically limited herein.
In practical applications, the supported digital coding format fed back by the second application may not be the same as the supported digital coding format of the first application, and at this time, negotiation may be performed between the two formats, so in this embodiment of the present invention, optionally, the sending, by the first application, a message to the second application according to all or part of the target information includes:
the first application determines whether at least one protocol supported by the second application matches at least one protocol supported by the first application;
if the first application judges that at least one protocol supported by the second application is matched with at least one protocol supported by the first application, directly adopting a protocol corresponding to the target information to send a message to the second application;
otherwise, the first application returns to the step of acquiring target information related to at least one communication protocol that the second application can support based on the natural language.
For example, the first application and the second application are two independently developed social software, whose buddy lists are to be synchronized, but do not know each other's digital transmission format, at which point the first application can query the second application in natural language, such as "how do your buddy list data be digitally encoded? ", the second application receives the message in the natural language form, and after semantic parsing, transmits its own digital encoding mode to the first application in the natural language mode, and after the first application receives the digital transmission format of the second application, it sends the buddy list information to the second application in the binary encoding mode at a high rate, finds that the name of some person is five words, and needs to increase the length of one word to transmit the name, then it can send" -can transmit the name can increase the length of one word? ", the second application finds available changes after receiving the message and detecting its own data format definition, then" may! ". Then the first application increases the length of a word (8bit) to transmit the name, if not, the code is all zero, so that the two consult a new digital coding mode, and the communication is carried out by adopting the digital coding mode obtained by the consultation.
It should be noted that, if the first application determines that the at least one protocol supported by the second application does not match the at least one protocol supported by the first application after returning to the step of acquiring the target information related to the at least one communication protocol supported by the second application, the acquisition may be continued until the at least one protocol supported by the first application matches, which is not specifically limited herein.
In this embodiment of the present invention, after receiving the request message, the second application may not understand the request message sent by the first application, and at this time, the first application and the second application may repeatedly communicate with each other until the second application can parse the request message sent by the first application, and therefore, in this embodiment of the present invention, after the first application sends the request message to the second application and before receiving the response message, the method further includes:
if the second application cannot understand the request message, the first application continues to communicate with the second application until the second application can analyze the request message. In the specific implementation process, the following mode can be adopted:
if the second application can not understand the request message, the first application continues to send the request message to the second application until the second application can understand the request message.
In the foregoing, it is described that the second application cannot understand the request message of the first application, and of course, there may also be a response message that the first application cannot understand the second application, at this time, the first application may also repeatedly communicate with the second application until the first application can parse the response message, so in this embodiment of the present invention, after the first application receives the response message returned by the second application, before the first application sends the message to the second application, the method further includes:
if the first application can not understand the response message, the first application continues to communicate with the second application until the first application can analyze the response message sent by the second application. In the specific implementation process, the following modes can be adopted:
if the first application can not understand the response message, the first application continues to receive the response message sent by the second application until the first application can understand the response message.
In this embodiment of the present invention, when the natural language is a text and the first application obtains target information related to at least one communication protocol that the second application can support based on the natural language, optionally, the following manner may be adopted:
the first application acquires the target information of a program in at least one form of two-dimensional codes, images and character marks based on an image acquisition module. For example, the first application obtains a URL (uniform resource Locator) address through two-dimensional code scanning, and information related to at least one communication protocol interacting with the second application can be downloaded through the URL address.
The image acquisition module may be a camera or may also be an image code scanner. Preferably, the first application acquires the target information in the form of at least one of a two-dimensional code, an image, and a text mark based on an image acquisition module, and the first application is in a first device, and the second application is in a second device. The interaction between different applications in the same device can be realized by means of shared memory, inter-program message transmission queues and the like.
When the natural language is a voice, and the first application acquires target information related to at least one communication protocol that the second application can support based on the natural language, optionally, the following method may be adopted:
the first application acquires the target information based on ultrasonic waves. Preferably, the mode is applied in the scene that the first application is in the first device and the second application is in the second device.
In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information related to the communication protocol supported by the second application can be acquired by using the natural language, and the acquired target information can be used for communicating with the second application subsequently, so that the defect that the communication with the application cannot be performed without storing the protocol of the related application in advance in the prior art can be overcome, and the range of application scenes is expanded.
Furthermore, after the target information is obtained, the message can be transmitted by adopting a digital coding format specified in the protocol, and the efficiency of transmitting data by adopting the digital coding format is higher, so that the method provided by the embodiment of the invention can also improve the transmission efficiency.
Referring to fig. 2A, in an embodiment of the present invention, a method for implementing communication between different applications based on natural language is further provided, including:
method 20A: step 200A: the method comprises the steps that a second application receives a request message sent by a first application based on a natural language, wherein the request message is used for requesting target information related to a communication protocol which can be supported by the second application; step 210A: sending a response message to the first application, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application; or
Method 20B: step 200B: the second application receives a request message sent by a first application, wherein the request message is used for requesting target information related to a communication protocol which can be supported by the second application; step 210B: and sending a response message to the first application based on the natural language, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application.
The natural language referred to in the embodiments of the present invention actually refers to a natural language that is non-preset content for a receiving party, not a natural language form of fixed content. The natural language of the non-preset content means that a receiver needs to perform semantic analysis; and the receiver can directly match the character strings by presetting the natural language of the content. For example, in the case of a natural language that does not include preset contents, "today is good and hot", or "today is good and high in temperature", or "today is fast dying", although the contents are different, the meanings are substantially the same, and any expression may be used. For another example, in the case of a natural language other than the preset content, the "current temperature" and the "current temperature" have different expressions, but have the same semantic meaning, and may be expressed in any form.
In the embodiment of the present invention, there are various expression modes of natural language, for example, the expression modes may be in a voice form, or may also be in a text form (for example, broadcast through an IP network), and both the voice form and the text form may adopt an ultrasonic mode. The text may be specifically a picture text or a text presented in a two-dimensional code form, the voice may be music, and of course, other forms are possible, which are not limited specifically herein.
It should be noted that, after receiving the request message sent by the first application based on the natural language, the second application needs to obtain a semantic analysis result of the request message, where when obtaining the semantic analysis result of the request message, the second application may perform semantic analysis on the request message to obtain a semantic analysis result; or after performing semantic analysis through the cloud application or the server, returning the semantic analysis result to the second application, and certainly, there may be other manners, which are not specifically limited herein.
While the second application obtains the semantic analysis result of the request message, the method for obtaining the semantic analysis result of other messages based on natural language form is similar to the method for obtaining the semantic analysis result of the request message, and will not be described in detail here.
In the embodiment of the present invention, the first application and the second application are both located on a first device; or
The first application is located on a first device and the second application is located on a second device.
In the embodiment of the present invention, optionally, the request message carries an indication protocol identifier;
the second application sends a response message to the first application, including:
and the second application returns a response message to the first application according to the indication protocol identification.
In this embodiment of the present invention, optionally, the target information includes a protocol identifier and/or a protocol definition.
In this embodiment of the present invention, optionally, the protocol definition information includes at least one of message transmission interface definition information, message format information, and signaling flow information.
The data transmission interface comprises physical layer electrical characteristic definition (such as transmission voltage size, signal power size, bus type, clock frequency and the like), physical layer data reading timing (such as data reading and writing timing, duty ratio regulation and the like), transmission layer protocol (such as channel coding, transmission checking mechanism, retransmission mechanism and the like), and network layer transmission protocol (such as IP address, UDP or TCP port number and the like).
The signaling flow is described below by taking the signaling flow for obtaining the friend information as an example:
step 1: the first application sends a list _ req message;
when a friend list needs to be obtained, a first application sends a list _ req message;
step 2: the second application sends out the list _ data after receiving the list _ req message.
And if the second application does not receive the list _ data within the range of 1s, the first application resends the list _ req message.
The signaling procedure for obtaining the friend information is only described as an example, but the signaling procedure is not limited to this.
In this embodiment of the present invention, optionally, the format information of the message includes a digital coding format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application. The format information of the message may further include a compression format.
The digital encoding format may be in the form of a table, such as the examples shown in tables 1, 2. Optionally, the table may be in a form of a picture, or may also be a document in a form of rich text, which is not limited herein.
In the embodiment of the present invention, optionally, the protocol identifier can be characterized by the characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
In an actual application, the supported digital coding format fed back by the second application may not be the same as the supported digital coding format of the first application, and at this time, negotiation may be performed between the two, and therefore in this embodiment of the present invention, optionally, after the second application sends a response message to the first application, the method further includes:
if the at least one protocol supported by the second application does not match the at least one protocol supported by the first application, the second application continues to send response messages to the first application.
In the embodiment of the present invention, after receiving the request message, the second application may not understand the request message sent by the first application, and at this time, the first application and the second application may repeatedly communicate until the second application can resolve the request message sent by the first application.
In the foregoing, it is described that the second application cannot understand the request message of the first application, and of course, there may be a response message that the first application cannot understand the second application, and at this time, the first application may repeatedly communicate with the second application until the first application can parse the response message.
In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information related to the communication protocol supported by the second application can be acquired by using the natural language, and the acquired target information can be used for communicating with the second application subsequently, so that the defect that the communication with the application cannot be performed without storing the protocol of the related application in advance in the prior art can be overcome, and the range of application scenes is expanded.
Furthermore, after the target information is obtained, the message can be transmitted by adopting a digital coding format specified in the protocol, and the efficiency of transmitting data by adopting the digital coding format is higher, so that the method provided by the embodiment of the invention can also improve the transmission efficiency.
Referring to fig. 3, an embodiment of the present invention further provides an apparatus 30 for implementing communication between different applications based on natural language, including:
an acquisition unit 300 in a first application, configured to acquire target information related to at least one communication protocol that can be supported by a second application based on a natural language;
a sending unit 310 in the first application, configured to send a message to the second application according to all or part of the target information.
The natural language referred to in the embodiments of the present invention actually refers to a natural language that is non-preset content for a receiving party, not a natural language form of fixed content. The natural language of the non-preset content means that a receiver needs to perform semantic analysis; and the receiver can directly match the character strings by presetting the natural language of the content. For example, in the case of a natural language that does not include preset contents, "today is good and hot", or "today is good and high in temperature", or "today is fast dying", although the contents are different, the meanings are substantially the same, and any expression may be used. For another example, in the case of a natural language other than the preset content, the "current temperature" and the "current temperature" have different expressions, but have the same semantic meaning, and may be expressed in any form.
In the embodiment of the present invention, there are various expression modes of natural language, for example, the expression modes may be in a voice form, or may also be in a text form (for example, broadcast through an IP network), and both the voice form and the text form may adopt an ultrasonic mode. The text may be specifically a picture text or a text presented in a two-dimensional code form, the voice may be music, and of course, other forms are possible, which are not limited specifically herein.
Of course, the first application may also define the specification by the FTP download protocol.
In this embodiment of the present invention, optionally, the first application and the second application are both located in a first device; or
The first application is located on a first device and the second application is located on a second device.
In this embodiment of the present invention, optionally, the sending unit 310 is further configured to send, based on a natural language, a request message to a second application, where the request message is used to request target information related to a communication protocol that can be supported by the second application;
the acquiring unit 300 in the first application acquires target information related to at least one communication protocol that can be supported by a second application based on natural language, including:
and receiving a response message returned by the second application, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application.
That is to say, a natural language is adopted when the first application sends the request message to the second application, but the form in which the second application returns the response message to the first application is not particularly limited, and may be a natural language form, or may also be a protocol specified by the first application, for example, the request message carries an indication protocol identifier;
the obtaining unit 300 receives a response message returned by the second application, including:
and receiving a response message returned by the second application according to the indication protocol identifier.
Of course, the second application may return the response message to the first application in other forms, and is not limited in this respect.
In the foregoing, it is described that the first application sends the message to the second application in the natural language, but the form in which the second application sends the message to the first application is not specifically limited.
Therefore, the sending unit 310 is further configured to send a request message to a second application, where the request message is used to request target information related to a communication protocol that can be supported by the second application;
the acquiring unit 300 in the first application acquires target information related to at least one communication protocol that can be supported by a second application based on natural language, including:
and receiving a response message returned by the second application based on the natural language, wherein the response message carries target information related to at least one communication protocol which can be supported by the second application.
In this embodiment of the present invention, the request message may be a message for directly requesting information related to a communication protocol, such as: the first application sends a message in natural language form to the second application asking for information related to the communication protocol, which then replies to the first application with the information related to the communication protocol.
Or the request message may also be a message for indirectly or implicitly requesting information related to the communication protocol, as long as the second application is triggered to return a message containing the target information to the first application, such as: the first application sends a username and password in natural language form to the second application (implicit way), which then replies to the first application with information related to the communication protocol (implicit response).
The foregoing describes a direct manner of requesting a message, or an implicit, indirect manner, and similarly, the response may be an explicit information request response directly to the first application, or an implicit, indirect response. And will not be described in detail herein.
In the embodiment of the invention, a broadcast sending and receiving mechanism can be used for realizing communication between two completely unrelated applications in the Android system, for example, an application A sends a broadcast, and an application B receives the broadcast and then executes related operations, so that mutual communication can be realized.
In this embodiment of the present invention, the acquiring unit 300 in the first application acquires, by the first application, target information related to at least one communication protocol that can be supported by the second application based on natural language, including:
acquiring the target information transmitted by the second application based on a broadcast message.
In this embodiment of the present invention, the apparatus further includes a receiving unit 320 and a processing unit 330, where:
the receiving unit 320 is configured to receive instruction information sent by a user;
the processing unit 330 is configured to obtain a semantic analysis result of the instruction information;
the sending unit 310 sends a request message to the second application, including:
and determining a request message corresponding to the semantic analysis result, and sending the request message to the second application.
When the first application obtains the semantic analysis result of the instruction information, the semantic analysis can be performed on the instruction information to obtain a semantic analysis result; of course, the semantic analysis result may also be returned to the first application after the semantic analysis is performed by the cloud device or the server, which is not specifically limited herein.
While the first application obtains the semantic analysis result of the instruction information, it is needless to say that the method for obtaining the semantic analysis result of other messages based on the natural language form is similar to the method for obtaining the semantic analysis result of the instruction information, and the detailed description thereof is omitted here.
Since the manner in which the first application sends the request message to the second application may be a natural language or may not be a natural language, the specific implementation manner may be applicable to a manner in which the first application sends the request message to the second application by using a natural language, or may be applicable to a manner in which the first application sends the request message to the second application by using another manner, and is not limited specifically herein.
The above-mentioned mode can be realized by adopting the following form:
the first application receives instruction information sent by a user and converts the instruction information into formatted data;
carrying out normalization processing on the formatted data to obtain a semantic analysis result of the instruction information;
and determining a request message corresponding to the semantic analysis result, and sending the request message to the second application.
In this embodiment of the present invention, the request message sent by the first application is based on a natural language, and the response message returned by the second application may also be based on a natural language, which is not limited herein.
For example, the first application and the second application are two independently developed social software, whose buddy lists are to be synchronized, but do not know each other's digital transmission format, at which point the first application can query the second application in natural language, such as "how do your buddy list data be digitally encoded? The second application receives the message in natural language form, and after semantic parsing, it passes its own digitally encoded form to the first application in natural language, e.g. "the list is transmitted in binary encoded format, for a total length of five bytes (40 bits), where the first byte represents the last name, the last three bytes represent the first name (if the first name is only one byte, then the last 16 bits are represented by the all zero sequence), and the last byte represents the gender. ", the second application may then send the binary sequence list corresponding to each byte in text form to the first application. After the first application receives the data, the semantic analysis is carried out to obtain the digital coding format of the second application, and the two parties can directly carry out high-efficiency data transmission in a uniform digital coding mode. For example, to transmit information of a boy student of zhang san in the first application to the second application, a string of binary sequences may be transmitted.
In this embodiment of the present invention, optionally, the target information includes a protocol identifier and/or protocol definition information.
In this embodiment of the present invention, optionally, the protocol definition information includes at least one of message transmission interface definition information, message format information, and signaling flow information. Of course, other information may be included, and is not specifically limited herein. The data transmission interface comprises physical layer electrical characteristic definition (such as transmission voltage size, signal power size, bus type, clock frequency and the like), physical layer data reading timing (such as data reading and writing timing, duty ratio regulation and the like), transmission layer protocol (such as channel coding, transmission checking mechanism, retransmission mechanism and the like), and network layer transmission protocol (such as IP address, UDP or TCP port number and the like).
The signaling flow is described below by taking the signaling flow for obtaining the friend information as an example:
step 1: the first application sends a list _ req message;
when a friend list needs to be obtained, a first application sends a list _ req message;
step 2: the second application sends out the list _ data after receiving the list _ req message.
And if the second application does not receive the list _ data within the range of 1s, the first application resends the list _ req message.
The signaling procedure for obtaining the friend information is only described as an example, but the signaling procedure is not limited to this.
In this embodiment of the present invention, optionally, the format information of the message includes a digital coding format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application. The format information of the message may also include a compression format.
The digital encoding format may be in the form of a table, such as the examples shown in tables 1, 2. Optionally, the table may be in a form of a picture, or may also be a document in a form of rich text, which is not limited herein.
In the embodiment of the present invention, optionally, the protocol identifier can be characterized by characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
The IP address related to the second application may refer to an IP address of a server where the second application runs, an IP address of a website where the second application runs, or an IP address of a computer where the second application runs, where the IP address may be a website address (e.g., www.mqpat.com) embodied in the form of a domain name.
In this embodiment of the present invention, optionally, the sending unit 310 in the first application sends a message to the second application according to all or part of the target information, where the sending unit includes:
determining a protocol corresponding to the characterization information according to the characterization information;
and sending a message to the second application by adopting the determined protocol.
In this embodiment of the present invention, optionally, the determining, by the sending unit 310, a protocol corresponding to the characterization information according to the characterization information includes:
acquiring corresponding protocol information through a third application;
wherein the third application is at least one of an internet server, a search engine and a natural language interaction engine.
For example, the first application obtains its own device ID fed back by the server in a natural language manner, and the first application uses the ID as a keyword to download a protocol definition supported by the second application through an internet search engine. In general, the manner in which the protocol definition is obtained is not limited. Writing a code segment in the first application as a natural language generation module, when it is to communicate with the second application, the first application first generating and issuing information about a query about natural language (such as voice or text) of the interface definition and data transmission format of the second application; the information about the interface type/data transmission format may be a type, software and hardware version number, a manufacturer, etc. of the second application, or may be a direct query interface definition/specification, which is not specifically limited herein.
In practical applications, the supported digital coding format fed back by the second application may not be the same as the supported digital coding format of the first application, and at this time, negotiation may be performed between the two formats, so in this embodiment of the present invention, optionally, the sending unit 310 in the first application sends a message to the second application according to all or part of the target information, including:
determining whether at least one protocol supported by the second application matches at least one protocol supported by the first application;
if the at least one protocol supported by the second application is matched with the at least one protocol supported by the first application, directly adopting the protocol corresponding to the target information to send a message to the second application;
otherwise, returning to the step of acquiring target information related to at least one communication protocol which can be supported by the second application based on the natural language.
For example, the first application and the second application are two independently developed social software, whose buddy lists are to be synchronized, but do not know each other's digital transmission format, at which point the first application can query the second application in natural language, such as "how do your buddy list data be digitally encoded? ", the second application receives the message in the natural language form, and after semantic parsing, transmits its own digital encoding mode to the first application in the natural language mode, and after the first application receives the digital transmission format of the second application, it sends the buddy list information to the second application in the binary encoding mode at a high rate, finds that the name of some person is five words, and needs to increase the length of one word to transmit the name, then it can send" -can transmit the name can increase the length of one word? ", the second application finds available changes after receiving the message and detecting its own data format definition, then" may! ". Then the first application increases the length of a word (8bit) to transmit the name, if not, the code is all zero, so that the two consult a new digital coding mode, and the communication is carried out by adopting the digital coding mode obtained by the consultation.
It should be noted that, if the first application determines that the at least one protocol supported by the second application does not match the at least one protocol supported by the first application after returning to the step of acquiring the target information related to the at least one communication protocol supported by the second application, the acquisition may be continued until the at least one protocol supported by the first application matches, which is not specifically limited herein.
In this embodiment of the present invention, after receiving the request message, the second application may not understand the request message sent by the first application, and at this time, the first application and the second application may repeatedly communicate with each other until the second application can parse the request message sent by the first application, and therefore, in this embodiment of the present invention, after the first application sends the request message to the second application and before receiving the response message, the method further includes:
if the second application cannot understand the request message, the first application continues to communicate with the second application until the second application can analyze the request message. In the specific implementation process, the following mode can be adopted:
if the second application can not understand the request message, the first application continues to send the request message to the second application until the second application can understand the request message.
In the foregoing, it is described that the second application cannot understand the request message of the first application, and of course, there may also be a response message that the first application cannot understand the second application, at this time, the first application may also repeatedly communicate with the second application until the first application can parse the response message, so in this embodiment of the present invention, after the first application receives the response message returned by the second application, before the first application sends the message to the second application, the method further includes:
if the first application can not understand the response message, the first application continues to communicate with the second application until the first application can analyze the response message sent by the second application. In the specific implementation process, the following modes can be adopted:
if the first application can not understand the response message, the first application continues to receive the response message sent by the second application until the first application can understand the response message.
In this embodiment of the present invention, optionally, when the natural language is a text, the obtaining unit 300 in the first application obtains, based on the natural language, target information related to at least one communication protocol that can be supported by the second application, where the target information includes:
and acquiring the target information of a program in at least one form of two-dimensional code, image and character mark based on an image acquisition module. For example, the first application obtains a URL address through two-dimensional code scanning, from which information relating to at least one communication protocol interacting with the second application can be downloaded.
The image acquisition module may be a camera or may also be an image code scanner. Preferably, the first application acquires the target information in the form of at least one of a two-dimensional code, an image, and a text mark based on an image acquisition module, and the first application is in a first device, and the second application is in a second device. The interaction between different applications in the same device can be realized by means of shared memory, inter-program message transmission queues and the like.
In this embodiment of the present invention, when the natural language is a voice, the obtaining unit 300 in the first application obtains target information related to at least one communication protocol that can be supported by the second application based on the natural language, including:
the target information is acquired based on the ultrasonic waves. Preferably, the mode is applied in the scene that the first application is in the first device and the second application is in the second device.
In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information related to the communication protocol supported by the second application can be acquired by using the natural language, and the acquired target information can be used for communicating with the second application subsequently, so that the defect that the communication with the application cannot be performed without storing the protocol of the related application in advance in the prior art can be overcome, and the range of application scenes is expanded.
Furthermore, after the target information is obtained, the message can be transmitted by adopting a digital coding format specified in the protocol, and the efficiency of transmitting data by adopting the digital coding format is higher, so that the method provided by the embodiment of the invention can also improve the transmission efficiency.
Referring to fig. 4, in an embodiment of the present invention, an apparatus 40 for implementing communication between different applications based on natural language is further provided, including:
a receiving unit 400 in the second application, configured to receive a request message sent by the first application based on a natural language, where the request message is used to request target information related to a communication protocol that can be supported by the second application; a sending unit 410 in the second application, configured to send a response message to the first application, where the response message carries target information related to at least one communication protocol that the second application can support; or
A receiving unit 400 in the second application, configured to receive, by the second application, a request message sent by a first application, where the request message is used to request target information related to a communication protocol that can be supported by the second application; a sending unit 410 in the second application, configured to send a response message to the first application based on a natural language, where the response message carries target information related to at least one communication protocol that can be supported by the second application.
The natural language referred to in the embodiments of the present invention actually refers to a natural language that is non-preset content for a receiving party, not a natural language form of fixed content. The natural language of the non-preset content means that a receiver needs to perform semantic analysis; and the receiver can directly match the character strings by presetting the natural language of the content. For example, in the case of a natural language that does not include preset contents, "today is good and hot", or "today is good and high in temperature", or "today is fast dying", although the contents are different, the meanings are substantially the same, and any expression may be used. For another example, in the case of a natural language other than the preset content, the "current temperature" and the "current temperature" have different expressions, but have the same semantic meaning, and may be expressed in any form.
In the embodiment of the present invention, there are various expression modes of natural language, for example, the expression modes may be in a voice form, or may also be in a text form (for example, broadcast through an IP network), and both the voice form and the text form may adopt an ultrasonic mode. The text may be specifically a picture text or a text presented in a two-dimensional code form, the voice may be music, and of course, other forms are possible, which are not limited specifically herein.
It should be noted that, after receiving the request message sent by the first application based on the natural language, the second application needs to obtain a semantic analysis result of the request message, where when obtaining the semantic analysis result of the request message, the second application may perform semantic analysis on the request message to obtain a semantic analysis result; or after performing semantic analysis through the cloud application or the server, returning the semantic analysis result to the second application, and certainly, there may be other manners, which are not specifically limited herein.
While the second application obtains the semantic analysis result of the request message, the method for obtaining the semantic analysis result of other messages based on natural language form is similar to the method for obtaining the semantic analysis result of the request message, and will not be described in detail here.
In this embodiment of the present invention, optionally, the first application and the second application are both located in a first device; or
The first application is located on a first device and the second application is located on a second device.
In the embodiment of the present invention, optionally, the request message carries an indication protocol identifier;
the sending unit 410 in the second application sends a response message to the first application, including:
the sending unit 410 in the second application returns a response message to the first application according to the indication protocol identifier.
In this embodiment of the present invention, optionally, the target information includes a protocol identifier and/or a protocol definition.
In this embodiment of the present invention, optionally, the protocol definition information includes at least one of message transmission interface definition information, message format information, and signaling flow information.
In the embodiment of the invention, the format information of the message comprises a digital coding format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application. The format information of the message may further include a compression format.
The digital encoding format may be in the form of a table, such as the examples shown in tables 1, 2. Optionally, the table may be in a form of a picture, or may also be a document in a form of rich text, which is not limited herein.
In the embodiment of the present invention, optionally, the protocol identifier can be characterized by the characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
In practical applications, the supported digital coding format fed back by the second application may not be the same as the supported digital coding format of the first application, and at this time, negotiation may be performed between the two, so in this embodiment of the present invention, optionally, the sending unit 410 in the second application continues to send the response message to the first application when at least one protocol supported by the second application does not match at least one protocol supported by the first application.
In the embodiment of the present invention, after receiving the request message, the second application may not understand the request message sent by the first application, and at this time, the first application and the second application may repeatedly communicate until the second application can resolve the request message sent by the first application.
In the foregoing, it is described that the second application cannot understand the request message of the first application, and of course, there may be a response message that the first application cannot understand the second application, and at this time, the first application may repeatedly communicate with the second application until the first application can parse the response message.
In the scheme, the target information related to the communication protocol is acquired by using the natural language, and because the natural language has high universality, even if the first application does not store the target information related to the communication protocol supported by the second application in advance, the target information related to the communication protocol supported by the second application can be acquired by using the natural language, and the acquired target information can be used for communicating with the second application subsequently, so that the defect that the communication with the application cannot be performed without storing the protocol of the related application in advance in the prior art can be overcome, and the range of application scenes is expanded.
Furthermore, after the target information is obtained, the message can be transmitted by adopting a digital coding format specified in the protocol, and the efficiency of transmitting data by adopting the digital coding format is higher, so that the method provided by the embodiment of the invention can also improve the transmission efficiency.
The methods and apparatus provided herein are not inherently related to any particular computer, virtual machine system, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a device will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, 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 an understanding of this description.
Those skilled in the art will appreciate that the modules in the apparatus of an embodiment may be adaptively changed and disposed in one or more apparatuses other than the embodiment. Several modules of embodiments may be combined into one module or unit or assembly and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or modules are mutually exclusive. Each feature disclosed in this specification (including any 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 appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Various apparatus embodiments of the 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 will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the modules in an apparatus according to embodiments of the present invention. The present invention may also be embodied as apparatus programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or 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 may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (19)

1. A method for realizing communication between different applications based on natural language is characterized by comprising the following steps:
the method comprises the steps that a second application receives a request message sent by a first application, wherein the request message is in a natural language form and is used for requesting target information related to a communication protocol which can be supported by the second application;
and the second application sends a response message to the first application, wherein the response message is in a natural language form, and the response message carries target information related to at least one communication protocol which can be supported by the second application.
2. The method of claim 1, wherein the first application and the second application are both located on a first device; or
The first application is located on a first device and the second application is located on a second device.
3. The method according to claim 1 or 2, characterized in that the request message carries an indication protocol identification;
the second application sends a response message to the first application, including:
and the second application returns a response message to the first application according to the indication protocol identification.
4. The method of claim 3, wherein the target information comprises a protocol identification and/or a protocol definition.
5. The method of claim 4, wherein the protocol definition information comprises at least one of message transmission interface definition information, format information of a message, and signaling flow information.
6. The method of claim 5, wherein the format information of the message comprises a digitally encoded format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application.
7. The method of claim 3, wherein a protocol identification can be characterized with characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
8. The method of claim 1, wherein after the second application sends a response message to the first application, the method further comprises:
if the at least one protocol supported by the second application does not match the at least one protocol supported by the first application, the second application continues to send response messages to the first application.
9. The method of claim 1, wherein the natural language is speech and/or text.
10. An apparatus for enabling communication between different applications based on natural language, comprising:
a receiving unit in the second application, configured to receive a request message sent by the first application, where the request message is in a natural language and is used to request target information related to a communication protocol that can be supported by the second application;
a sending unit in the second application, configured to send a response message to the first application, where the response message is in a natural language form, and the response message carries target information related to at least one communication protocol that the second application can support.
11. The apparatus of claim 10, wherein the first application and the second application are both located on a first device; or
The first application is located on a first device and the second application is located on a second device.
12. The apparatus according to claim 10 or 11, wherein the request message carries an indication protocol identifier;
the sending unit in the second application sends a response message to the first application, including:
and the sending unit in the second application returns a response message to the first application according to the indication protocol identifier.
13. The apparatus of claim 12, in which the target information comprises a protocol identification and/or a protocol definition.
14. The apparatus of claim 13, wherein the protocol definition information comprises at least one of message transmission interface definition information, format information of a message, and signaling flow information.
15. The apparatus of claim 14, wherein the format information of the message comprises a digitally encoded format;
wherein the digital encoding format includes at least one of a field, a length, a value range, and a data type of the data that can be received by the second application.
16. The apparatus of claim 12, wherein a protocol identification can be characterized with characterization information;
the representation information comprises at least one of an identification ID of the second application, a type of the second application, a version number of the second application, an Internet Protocol (IP) address related to the second application and related keywords.
17. The apparatus of claim 10, wherein the sending unit in the second application continues to send response messages to the first application when the at least one protocol supported by the second application and the at least one protocol supported by the first application do not match.
18. The apparatus of claim 10, in which the natural language is speech and/or text.
19. An electronic device, comprising:
a memory and one or more processors;
wherein the memory is communicatively coupled to the one or more processors and has stored therein instructions executable by the one or more processors to enable the one or more processors to implement the method of any one of claims 1-9.
CN201710575070.3A 2017-07-14 2017-07-14 Method and device for realizing communication between different applications based on natural language Active CN107370731B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710575070.3A CN107370731B (en) 2017-07-14 2017-07-14 Method and device for realizing communication between different applications based on natural language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710575070.3A CN107370731B (en) 2017-07-14 2017-07-14 Method and device for realizing communication between different applications based on natural language

Publications (2)

Publication Number Publication Date
CN107370731A CN107370731A (en) 2017-11-21
CN107370731B true CN107370731B (en) 2020-09-04

Family

ID=60308382

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710575070.3A Active CN107370731B (en) 2017-07-14 2017-07-14 Method and device for realizing communication between different applications based on natural language

Country Status (1)

Country Link
CN (1) CN107370731B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111541662B (en) * 2020-04-15 2022-09-23 赞同科技股份有限公司 Communication method based on binary communication protocol, electronic equipment and storage medium
CN116132385A (en) * 2022-08-18 2023-05-16 马上消费金融股份有限公司 Data forwarding method, device, computer equipment and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106921660A (en) * 2017-02-28 2017-07-04 国网福建省电力有限公司 A kind of method for supporting random communication protocol shared channel resources

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8725513B2 (en) * 2007-04-12 2014-05-13 Nuance Communications, Inc. Providing expressive user interaction with a multimodal application
CN104396290B (en) * 2012-07-02 2018-07-10 Sk普兰尼特有限公司 Single certificate service system and its operating method
CN104113529A (en) * 2014-06-23 2014-10-22 胡栋 Natural language understanding-based method and system for fusion of internet of things and social network fusion
CN106375535B (en) * 2015-07-20 2020-02-14 中兴通讯股份有限公司 Contact person information synchronization method and device
CN105376398A (en) * 2015-09-30 2016-03-02 联想(北京)有限公司 An information processing method and an electronic apparatus

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106921660A (en) * 2017-02-28 2017-07-04 国网福建省电力有限公司 A kind of method for supporting random communication protocol shared channel resources

Also Published As

Publication number Publication date
CN107370731A (en) 2017-11-21

Similar Documents

Publication Publication Date Title
CN107612909B (en) Information interaction method, device and equipment about Internet of things equipment
CN108965484B (en) Internet of things data transmission method, system and terminal
CN104137520B (en) A kind of information push method and device
US10931735B2 (en) Application discovery
US9774642B2 (en) Method and device for pushing multimedia resource and display terminal
JP6584186B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND PROGRAM
WO2017174026A1 (en) Client connection method and system
JP2009157650A (en) Content providing system, content providing method, and content providing program
CN110324405A (en) Message method, device, system and computer readable storage medium
CN104967646B (en) Document down loading method and device
CN107370731B (en) Method and device for realizing communication between different applications based on natural language
CN107302720A (en) User feedback method and device, problem feedback traffic architecture system
CN110581838B (en) Method for continuously requesting data stream, electronic device and computer equipment
WO2017101409A1 (en) Video push notification method, system, and server between different client ends
CN107395583B (en) Method and device for realizing communication between different applications based on natural language
CN106302093B (en) Communication method, system and server
CN104980481B (en) Method and system, the electric terminal of data are transmitted between electric terminal
CN107454066B (en) Method and equipment for realizing communication between equipment based on natural language
US20180218419A1 (en) Method and apparatus for providing digital product using user account synchronization
WO2015021804A1 (en) Information publishing method, information output method, device, server and system
CN109525550B (en) Data message processing method, device and system
KR102435756B1 (en) Device group control system and method for controlling the same
EP2988553A1 (en) Method, device and system for querying for information
WO2021082945A1 (en) Remote management method and system, terminal device and server
WO2019161600A1 (en) Method, device, server and medium for adding member to community

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant