A method of performing speech recognition by a device, the method comprising: training a weighted finite state transducer model by inputting a subword extracted from each of a plurality of named entities included in a vocabulary list to the weighted finite state transducer model and outputting a word or word sequence representing a named entity from the weighted finite state transducer model; receiving a speech input from a user; by using a first artificial intelligence decoding model, obtaining a feature vector indicating a probability of predicting a subword from the received speech input, and obtaining a first string comprising a plurality of predicted strings based on the feature vector; inputting the feature vector to a second AI decoding model that uses the weighted finite state transducer model that is trained to predict a training word or training word sequence representing a named entity, from a training subword extracted from a plurality of named training entities; by using the second AI decoding model, obtaining a second string based on the feature vector, the second string comprising a recognized word sequence that corresponds to at least one of a plurality of predetermined named entities, and an unrecognized word sequence that does not correspond to any one of the plurality of predetermined named entities; and outputting a text corresponding to the received speech input by substituting the unrecognized word sequence of the second string with a word sequence included in the first string, wherein the training of the weighted finite state transducer comprises: obtaining a confidence score at which the subword is predicted as a certain named entity, through training by using frequencies and arrangement orders of subword; training the weighted finite state transducer regarding weights through state transition using prior probabilities obtained based on the frequencies and the arrangement orders of the subwords; and outputting the word or the word sequence based on a probability that the input subword is predictable as the word or the word sequence representing the named entity. training a weighted finite state transducer model by inputting a subword extracted from each of a plurality of named entities included in a vocabulary list to the weighted finite state transducer model and outputting a word or word sequence representing a named entity from the weighted finite state transducer model; receiving a speech input from a user; by using a first artificial intelligence decoding model, obtaining a feature vector indicating a probability of predicting a subword from the received speech input, and obtaining a first string comprising a plurality of predicted strings based on the feature vector; inputting the feature vector to a second AI decoding model that uses the weighted finite state transducer model that is trained to predict a training word or training word sequence representing a named entity, from a training subword extracted from a plurality of named training entities; by using the second AI decoding model, obtaining a second string based on the feature vector, the second string comprising a recognized word sequence that corresponds to at least one of a plurality of predetermined named entities, and an unrecognized word sequence that does not correspond to any one of the plurality of predetermined named entities; and outputting a text corresponding to the received speech input by substituting the unrecognized word sequence of the second string with a word sequence included in the first string, wherein the training of the weighted finite state transducer comprises: obtaining a confidence score at which the subword is predicted as a certain named entity, through training by using frequencies and arrangement orders of subword; training the weighted finite state transducer regarding weights through state transition using prior probabilities obtained based on the frequencies and the arrangement orders of the subwords; and outputting the word or the word sequence based on a probability that the input subword is predictable as the word or the word sequence representing the named entity. obtaining a confidence score at which the subword is predicted as a certain named entity, through training by using frequencies and arrangement orders of subword; training the weighted finite state transducer regarding weights through state transition using prior probabilities obtained based on the frequencies and the arrangement orders of the subwords; and outputting the word or the word sequence based on a probability that the input subword is predictable as the word or the word sequence representing the named entity.