编写一个可以检测输入文本情感的Python函数。
“I'm so happy with my new job!”
可以使用自然语言处理工具NLTK和情感分析器VADER来实现：

```python
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer

nltk.download('vader_lexicon')

def detect_sentiment(text):
    analyzer = SentimentIntensityAnalyzer()
    scores = analyzer.polarity_scores(text)
    sentiment = 'positive' if scores['compound'] > 0 else 'negative' if scores['compound'] < 0 else 'neutral'
    return sentiment

text = "I'm so happy with my new job!"
sentiment = detect_sentiment(text)
print(sentiment)  # 输出 positive
```