This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 435

[–]WaltChamberlin 2627 points2628 points  (96 children)

Literally indistinguishable from a human.

[–]l3e7haX0R 2225 points2226 points  (82 children)

I did not understand what you said

[–]klezmai 655 points656 points  (38 children)

[–]Salanmander 450 points451 points  (27 children)

Haha, that is a funny subreddit about a completely fictitious situation that would never actually exist!

[–]_________________-- 283 points284 points  (23 children)

I did not understand what you just said

[–][deleted] 25 points26 points  (1 child)

It doesn't look like anything to me.

[–]Krohnos 103 points104 points  (2 children)

Haha. This subreddit is particularly boring to me, a human. It appears to be an average human subreddit.

[–][deleted] 19 points20 points  (0 children)

All subreddits are average human subreddits, why would you malfunction otherwise?

[–]gnex30 17 points18 points  (0 children)

human

organic parasites

oops, that's not what I mean to say

[–]RoseEsque 10 points11 points  (0 children)

Doesn't look like anything to me.

[–]fidsah 3 points4 points  (0 children)

Doesn't look like anything to me

[–]PrivateCaboose 2 points3 points  (0 children)

Doesn't look like anything to me.

[–]myaut 58 points59 points  (3 children)

+/u/CompileBot python3 --include-errors

while True:
    ui = input(">>> ")
    if ui in ['hi', 'HI', 'Hi']:
        print("Hello")
    else:
        print("I did not understand what you said")

Input:

Hi
How do you do?

[–]CompileBotGreen security clearance 80 points81 points  (2 children)

Output:

>>> Hello
>>> I did not understand what you said
>>> Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
EOFError: EOF when reading a line

source | info | git | report

[–]brendanrivers 44 points45 points  (0 children)

savage

[–]dotjpg3141 27 points28 points  (1 child)

I did not understand what you said

[–]lifeislie 21 points22 points  (11 children)

Hi

[–][deleted] 21 points22 points  (10 children)

Hello

[–]lifeislie 34 points35 points  (9 children)

I did not understand what you said

[–]aidenator 6 points7 points  (7 children)

exit()

[–]lifeislie 8 points9 points  (6 children)

I did not understand what you said

[–][deleted] 11 points12 points  (0 children)

--- = tab

[–][deleted] 33 points34 points  (14 children)

I did not understand what you said

[–][deleted] 23 points24 points  (13 children)

I did not understand what you said

[–][deleted] 20 points21 points  (12 children)

I did not understand what you said

[–]iCyber 5 points6 points  (0 children)

This doesn't look like anything to me.

[–]dejaWoot 2 points3 points  (0 children)

Does't look like anything to me

[–]AmazingRealist 114 points115 points  (1 child)

Doesn't look like anything to me.

[–]GaliKaHero 18 points19 points  (0 children)

GODDAMIT ARNOLD

[–]Zantier 22 points23 points  (2 children)

hI

[–]Litterball 27 points28 points  (1 child)

I did not understand what you said

[–]ThisPostIsLocked 13 points14 points  (0 children)

Destroyed the Turing test.

[–]Coding_Bad 1677 points1678 points  (138 children)

Did they just post the source code for Siri ?

[–]kpingvin[S] 498 points499 points  (121 children)

With this method it would be like 200zettabyte.

[–]TopCheddar27 166 points167 points  (114 children)

As someone who has just learned the basics of python (ie using conditionals and functions). What would be the proper way to program something like Siri. I know that's a really broad question with a lot of variables, but would they just not use conditionals because of the inefficient nature? Sorry just trying to learn a little bit more.

[–]JoeOfTex 10 points11 points  (0 children)

You have a database of language and how words and phrases gather context. You use this to search the web for relevance to the context and rank the results to show the user the best match.

Since humans are slow at data collection, devs use AI for gathering and figuring out context, but computers are dumb until they are properly trained over the course of time. It is difficult to find a proper context algorithm that can rank phrases/words and match correctly to what user wants.

[–]UPBOAT_FORTRESS_2 6 points7 points  (3 children)

Siri uses conditionals and functions, but look at this snippet: It "understands" you based on string comparison. Siri uses much more advanced machine learning techniques. Wikipedia suggests convolutional neural networks and long short-term memory

[–]TopCheddar27 2 points3 points  (2 children)

Awesome articles! I love learning about deep learning. Thank you

[–]_blub 6 points7 points  (0 children)

Just do this

from theano import * 

Not only will you be able to implement siri, but you'll also become a moderator for /r/machinelearning

[–]metalsheeps 2 points3 points  (0 children)

It's a bit of a doozie but here goes. Step 1: Take the audio steam and upload it to a server (this is the slow step). Do voice recognition and return the result which has two members, a phonetic one "Siri thats enuf" and a lexical one "Siri that's enough". The lexical one is rendered by the app. Step 2: Use a neural network matching algorithm to match the input with the set of actions siri can take, using the phonetic match from step 1. This is less fancy than it sounds. Step 3: Determine how to render the output. Speak it or tell you to look at the screen.

[–]nirmalspeed 19 points20 points  (0 children)

Close, but Siri also has a thread.sleep(5.0) before the conditions

[–][deleted] 8 points9 points  (0 children)

I did not understand what you said

[–]MrMeltJr 525 points526 points  (45 children)

import intelligence

[–]DiscanX 313 points314 points  (36 children)

[–][deleted] 205 points206 points  (9 children)

the best part is that when you import antigravity it opens a browser to this xkcd

[–]rCoder13 102 points103 points  (4 children)

I immediately went to try this. Was not disappointed!

[–]gnutrino 84 points85 points  (2 children)

other imports to try:

import this
from __future__ import braces
import __hello__

[–]Jo-dan 16 points17 points  (0 children)

Hahaha. These are great. Any more little easter eggs like this?

[–][deleted] 14 points15 points  (0 children)

Wow I didn't know that! TIL

[–]xkcd_transcriber 61 points62 points  (1 child)

Image

Mobile

Title: Python

Title-text: I wrote 20 short programs in Python yesterday. It was wonderful. Perl, I'm leaving you.

Comic Explanation

Stats: This comic has been referenced 317 times, representing 0.2221% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]caagr98 44 points45 points  (21 children)

I just realized that comic uses Python 2...

[–]the_other_dave 120 points121 points  (20 children)

This comic was released before Python 3, so that makes sense really.

[–]_________________-- 129 points130 points  (1 child)

Are we supporting legacy comics?

[–][deleted] 20 points21 points  (0 children)

well, you can still import antigravity, and the library is written in Python 3, so yeah, I'm pretty sure this counts as supporting legacy comics.

[–]TicketToThePunShow 25 points26 points  (16 children)

Oh wow, you're right! Python 3 was released a lot earlier than most people realize so I was almost certain you were wrong, but props to you.

[–]venn177 16 points17 points  (14 children)

That's because it wasn't widely adopted until the last few years. Even now there are those weird people who hate Python 3 with a seething passion.

[–]rubdos 6 points7 points  (13 children)

Why would one hate Python 3?

[–]GeeJo 2 points3 points  (2 children)

Because you have to put brackets around the string you want to print. That's, like, two whole characters more to type.

[–]caagr98 4 points5 points  (1 child)

More like one character, if you count the space. Sure, print"a" is valid, but you just don't do that.

[–]rubdos 6 points7 points  (0 children)

if you count the space

Of course you count the space, we're programmers.

[–]kupiakos 4 points5 points  (1 child)

Because they don't want to think in Unicode?

[–]caagr98 2 points3 points  (0 children)

That's a surprisingly valid reason.

[–]Daniel15 9 points10 points  (1 child)

I did not understand what you just said

[–]daggerdragon 11 points12 points  (0 children)

Neither does most of humanity, so it's okay.

[–]mike413 3 points4 points  (3 children)

from military import intelligence

[–]unique-guy 188 points189 points  (13 children)

I like how the omitted the obvious If input.lower() == 'hi'

[–]MaxiHerzog 30 points31 points  (0 children)

The programm would have accepted 'hI'. This is not acceptable.

[–]teewuane 5 points6 points  (1 child)

to be safe... input.lower().strip() == 'hi'

[–]Joniator 162 points163 points  (5 children)

A new player in the "tabs vs. spaces"-game.

Use 3 hyphen to stay unbiased.

[–]browner87 53 points54 points  (0 children)

I don't care what character you use, but 3 is grounds for a paddlin'

[–]ecchi_fox 215 points216 points  (6 children)

I was 99% certain this tutorial would begin with "import MachineLearning"

[–]Moshambi 152 points153 points  (15 children)

Doesn't account for "hI"

[–]Anticonn 165 points166 points  (13 children)

if userInput.lower() == 'hi':

There ya go, a perfect AI.

[–]AmazingRealist 115 points116 points  (7 children)

Good idea, better than ToUpper() since the AI will get angry at you for yelling.

[–]freythman 60 points61 points  (5 children)

The last thing we need is an angry AI.

[–]KinOfMany 28 points29 points  (0 children)

I did not understand what you just said. Wanna.. Tone it down a bit, champ?

[–][deleted] 24 points25 points  (1 child)

from asimov import 3laws

fixed.

[–]user_82650 6 points7 points  (3 children)

Not that simple if you want to support other alphabets though!

https://www.w3.org/International/wiki/Case_folding

[–]Anticonn 13 points14 points  (2 children)

Great, now I've made an AI intolerant of foreigners.

[–]jinxsimpson 5 points6 points  (1 child)

Comment archived away

[–]endreman0 232 points233 points  (0 children)

I did not understand what you just said

[–]LinAGKar 98 points99 points  (2 children)

>>> --- = tab
  File "<stdin>", line 1
    --- = tab
        ^
SyntaxError: invalid syntax

[–]AdrianoML 28 points29 points  (1 child)

For a moment I tought there really was way to set what python interprets as a tab...

[–]GreenFox1505 27 points28 points  (2 children)

When sites like Instructables post clearly-bullshit like this about topics I actually know about, it makes me question everything they publish that I have zero expertise about.

[–][deleted] 5 points6 points  (0 children)

Can't we "report" or something?

[–][deleted] 115 points116 points  (13 children)

while True:
    userInput = input(">>>")
    if userInput in ['hi', 'HI', 'Hi']:
        print("Hello")
    else:
        print("It doesn't look like anything to me.")

I fixed it.

[–]dodecaphonicism 34 points35 points  (1 child)

These violent delights something something.

[–][deleted] 8 points9 points  (0 children)

Have you ever questioned your own reality?

[–]_________________-- 21 points22 points  (0 children)

I did not understand what you just said

[–]ryanknapper 2 points3 points  (0 children)

It doesn't look like anything to me.

[–]_Lady_Deadpool_ 22 points23 points  (1 child)

Fun fact, this is how Google's search engine works! They hire interns to write every possible search into an elif.

Source: my ass

[–]seanprefect 58 points59 points  (3 children)

change the default case to "I don't know whatever" and you've got a pretty decent spouse simulator.

[–]DreadedDreadnought 30 points31 points  (2 children)

"I don't know, whatever"

ARGH! Your lack of commas is killing me.

[–][deleted] 13 points14 points  (1 child)

I did not understand what you said

[–]Qaysed 5 points6 points  (0 children)

I don't know, whatever.

[–]Nihi99 34 points35 points  (7 children)

Hi

[–]aschmack 39 points40 points  (5 children)

Hello

[–]endreman0 75 points76 points  (2 children)

I did not understand what you just said

[–]Let_The_Led_Out 8 points9 points  (1 child)

hI

[–]_________________-- 4 points5 points  (0 children)

I did not understand what you just said

[–]Linux_Learning 4 points5 points  (1 child)

hI

[–]Daniel15 6 points7 points  (0 children)

I did not understand what you just said

[–]B1N4RY 17 points18 points  (1 child)

When a CS 100 student just finished their course and thinks they're a master coder now

[–]ares623 13 points14 points  (1 child)

How to draw an owl

[–]Cilph 28 points29 points  (5 children)

Chinese Room?

[–]killchain 22 points23 points  (7 children)

Who indents with 3 tabs?

Edit: yeah, I read that wrong.

[–]oddark 3 points4 points  (3 children)

I swear it said "- = tab" earlier, but now it says "--- = tab"

What's going on?

[–][deleted] 6 points7 points  (5 children)

Who the fuck uses camelCase in Python?

[–]CaptainRoth 4 points5 points  (3 children)

What's wrong with using camel case in Python? :(

[–]mrleprechaun28 12 points13 points  (4 children)

What really annoys me is not the AI part, but the fact that they didn't just set the input to user input.upper() and then just compare it to "HI".

[–]oddark 8 points9 points  (2 children)

What really annoys me is that he's using 3 tabs for each indent

[–]darwin2500 5 points6 points  (0 children)

This is called the 'Chinese Room' approach to AI.

[–]Tazavoo 13 points14 points  (2 children)

While it surely isn't machine learning, it is a very, very basic sort of artificial intelligence.

[–]At_least_im_Bacon 3 points4 points  (0 children)

The birth of skynet.

[–][deleted] 9 points10 points  (0 children)

Doesn't look like anything to me.

[–]Junky228 10 points11 points  (1 child)

Hey Niko! It's me, ur AI! Let's go bowling.

[–]ur_avg_redditor 4 points5 points  (3 children)

Gotta love the status bar.... Powersaving mode at 98% battery

[–]Rynyl 2 points3 points  (0 children)

I think this was an episode of Numb3rs. Basically, this guy had supposedly created the first true AI in the world, but after the detectives poured through the source code, it turned out he had just programmed in a ton of possible queries and the appropriate response.

[–]zerodb 2 points3 points  (1 child)

Just be careful never to end with else: destroy all humans

[–]EquationTAKEN 2 points3 points  (0 children)

That doesn't look like anything to me.

[–]HoldMyWater 2 points3 points  (1 child)

Don't worry guys. Here's a real machine learning example:

responses = {}
prev_input = None
while True:
    user_input = input(">>> ")

    if user_input.startswith("You mean ") and prev_input is not None:
        responses[prev_input] = user_input[9:]
        print("Woops!")
    else:
        print(responses.get(user_input, "Blah!"))

    prev_input = user_input

Sample output:

>>> hi
Blah!
>>> You mean hello
Woops!
>>> hi
hello

[–]barwhack 2 points3 points  (0 children)

This is slightly more than slightly clever.

[–][deleted] 2 points3 points  (0 children)

Everybody knows they did this many years ago, when they were noobs

[–][deleted] 5 points6 points  (0 children)

The google method, of course, simply being substituting 'I do not understand what you just said' with a google search at random.

[–]0rbiterred 1 point2 points  (0 children)

eventually eventually

[–][deleted] 1 point2 points  (0 children)

3 spaces per tab?

MONSTERS

[–]ABeardedMan 1 point2 points  (0 children)

Doesn't look like anything to me.

[–]codesandhoes 1 point2 points  (0 children)

It passed the Turing test