Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- Dim sentence() As String
- Do
- sentence = Split(Console.ReadLine(), " ")
- For i = 0 To sentence.GetLength(0) - 1
- sentence(i) = wordtype(sentence(i))
- Next
- Console.WriteLine(Join(sentence, " ") & ".")
- Loop
- End Sub
- Public Function GetPageHTML(ByVal URL As String) As String
- Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(URL)
- Dim response As System.Net.HttpWebResponse = request.GetResponse()
- Dim sr As New System.IO.StreamReader(response.GetResponseStream)
- GetPageHTML = sr.ReadToEnd
- End Function
- Public Function wordtype(ByVal word As String) As String
- Dim type As String
- Dim page As String = GetPageHTML("http://dictionary.reference.com/browse/" & word)
- type = Mid(page, InStr(page, "<span class=" & Chr(34) & "pg" & Chr(34) & ">") + 17)
- type = Mid(type, 1, InStr(type, "<") - 1)
- If InStr(type, ",") <> 0 Then
- type = Mid(type, 1, InStr(type, ",") - 1)
- End If
- wordtype = type
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment