An electronic device comprising: a display; a memory storing a trained model; and at least one processor configured to: control to output, via the display, a first virtual keyboard when the device is in a first orientation; obtain a first swipe input on the output first virtual keyboard, wherein the first swipe input forms a first trajectory connecting a plurality of keys on the first virtual keyboard; normalize the size of the first virtual keyboard to a pre-set size; normalize the first trajectory based on the normalization of the first virtual keyboard; obtain, by applying the normalized first trajectory to the trained model, a first word corresponding to the first swipe input; control to output, via the display, a second virtual keyboard when the device is in a second orientation, wherein a key layout of the first virtual keyboard and the second virtual keyboard is the same and at least one of size, shape, or interval between keys of the first virtual keyboard is different from the second virtual keyboard;obtain a second swipe input on the output second virtual keyboard, wherein the second swipe input forms a second trajectory connecting a plurality of keys on the second virtual keyboard; normalize the size of the second virtual keyboard to the pre-set size normalize the second trajectory based on the normalization of the second virtual keyboard; and obtain, by applying the normalized second trajectory to the trained model, a second word corresponding to the second swipe input. a display; a memory storing a trained model; and at least one processor configured to: control to output, via the display, a first virtual keyboard when the device is in a first orientation; obtain a first swipe input on the output first virtual keyboard, wherein the first swipe input forms a first trajectory connecting a plurality of keys on the first virtual keyboard; normalize the size of the first virtual keyboard to a pre-set size; normalize the first trajectory based on the normalization of the first virtual keyboard; obtain, by applying the normalized first trajectory to the trained model, a first word corresponding to the first swipe input; control to output, via the display, a second virtual keyboard when the device is in a second orientation, wherein a key layout of the first virtual keyboard and the second virtual keyboard is the same and at least one of size, shape, or interval between keys of the first virtual keyboard is different from the second virtual keyboard;obtain a second swipe input on the output second virtual keyboard, wherein the second swipe input forms a second trajectory connecting a plurality of keys on the second virtual keyboard; normalize the size of the second virtual keyboard to the pre-set size normalize the second trajectory based on the normalization of the second virtual keyboard; and obtain, by applying the normalized second trajectory to the trained model, a second word corresponding to the second swipe input. control to output, via the display, a first virtual keyboard when the device is in a first orientation; obtain a first swipe input on the output first virtual keyboard, wherein the first swipe input forms a first trajectory connecting a plurality of keys on the first virtual keyboard; normalize the size of the first virtual keyboard to a pre-set size; normalize the first trajectory based on the normalization of the first virtual keyboard; obtain, by applying the normalized first trajectory to the trained model, a first word corresponding to the first swipe input; control to output, via the display, a second virtual keyboard when the device is in a second orientation, wherein a key layout of the first virtual keyboard and the second virtual keyboard is the same and at least one of size, shape, or interval between keys of the first virtual keyboard is different from the second virtual keyboard;obtain a second swipe input on the output second virtual keyboard, wherein the second swipe input forms a second trajectory connecting a plurality of keys on the second virtual keyboard; normalize the size of the second virtual keyboard to the pre-set size normalize the second trajectory based on the normalization of the second virtual keyboard; and obtain, by applying the normalized second trajectory to the trained model, a second word corresponding to the second swipe input.