Skip to content

Instantly share code, notes, and snippets.

@ferrygun
Created June 8, 2020 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrygun/f99de0663f7229a96db43c58f9b41ec5 to your computer and use it in GitHub Desktop.
Save ferrygun/f99de0663f7229a96db43c58f9b41ec5 to your computer and use it in GitHub Desktop.
txt = ["blair prepares to name poll date tony blair is likely to name 5 may as election day when parliament returns from its easter break the bbc s political editor has learned. andrew marr says mr blair will ask the queen on 4 or 5 april to dissolve parliament at the end of that week. mr blair has so far resisted calls for him to name the day but all parties have stepped up campaigning recently. downing street would not be drawn on the claim saying election timing was a matter for the prime minister. a number 10 spokeswoman would only say: he will announce an election when he wants to announce an election. the move will signal a frantic week at westminster as the government is likely to try to get key legislation through parliament. the government needs its finance bill covering the budget plans to be passed before the commons closes for business at the end of the session on 7 april. but it will also seek to push through its serious and organised crime bill and id cards bill. mr marr said on wednesday s today programme: there s almost nobody at a senior level inside the government or in parliament itself who doesn t expect the election to be called on 4 or 5 april. as soon as the commons is back after the short easter recess tony blair whips up to the palace asks the queen to dissolve parliament ... and we re going. the labour government officially has until june 2006 to hold general election but in recent years governments have favoured four-year terms."]
seq = tokenizer.texts_to_sequences(txt)
padded = pad_sequences(seq, maxlen=max_length)
pred = model.predict(padded)
labels = ['sport', 'bussiness', 'politics', 'tech', 'entertainment']
print(pred)
print(np.argmax(pred))
print(labels[np.argmax(pred)-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment